hi
i have panel1 and modal popup extender..and i have button1 on gridview1 as templatefield..
how can i use button1 as targetcontrolid of modalpopupextender ?
Thanks
Mark as me if my question or my answer can be helpful for you :)
![]() |
0 |
![]() |
hi..
go to your ajax-toolkit.dll folder..drag the ajax-toolkit.dll file from there and drop on your toolbox of visual studio..
you can see all ajax tools in which tab you have droped it..
Rushik
(please mark as an answer, if this helps you.)
![]() |
0 |
![]() |
hi
i have panel1 and modal popup extender..and i have button1 on gridview1 as templatefield..
how can i use button1 as targetcontrolid of modalpopupextender ?
Thanks
Mark as me if my question or my answer can be helpful for you :)
![]() |
0 |
![]() |
Please refer to my reply in these threads:
http://forums.asp.net/p/1270002/2410443.aspx#2410443
http://forums.asp.net/p/1289246/2504999.aspx#2504999
http://forums.asp.net/p/1288643/2495376.aspx#2495376
http://forums.asp.net/p/1331428/2678179.aspx#2678179
http://forums.asp.net/p/1353468/2776610.aspx#2776610Best regards,
Mark as me if my question or my answer can be helpful for you :)
![]() |
0 |
![]() |
hi
when my page.aspx load, i can see panel1 related to modalpopupextender then panel1 be closed..
But it should not be displayed when page.aspx load..
how can i fix it ?
Thanks
Mark as me if my question or my answer can be helpful for you :)
![]() |
0 |
![]() |
Hi,
We cannot set button that is in Gridview's template for modalpopupextender's TargetControlID directly because they are not in same name container.
In this case, you can try to show this modalpopup in codebehind class. For example:
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GridView1.DataSource = GetDT();
GridView1.DataBind();
}
}public DataTable GetDT()
{
DataTable dt = new DataTable();
dt.Columns.Add("name", typeof(String));
dt.Columns.Add("detail", typeof(String));DataRow dr = dt.NewRow();
dr[0] = "James";
dr[1] = "James is my director!";
dt.Rows.Add(dr);DataRow dr1 = dt.NewRow();
dr1[0] = "Thomas";
dr1[1] = "Thomas is engineer!";
dt.Rows.Add(dr1);DataRow dr2 = dt.NewRow();
dr2[0] = "Vince";
dr2[1] = "Vince is engineer too!!";
dt.Rows.Add(dr2);return dt;
}
protected void Button1_Click(object sender, EventArgs e)
{
ModalPopupExtender1.Show();
}</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<style type="text/css">
.modalBackground {
background-color:Gray;
filter:alpha(opacity=70);
opacity:0.7;
}.modalPopup {
background-color:#ffffdd;
border-width:3px;
border-style:solid;
border-color:Gray;
padding:3px;
width:250px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="sm" runat="server">
</asp:ScriptManager>
<div>
<asp:gridview ID="GridView1" runat="server" >
<columns>
<asp:templatefield HeaderText="Buton">
<itemtemplate>
<asp:button ID="Button1" runat="server" OnClick="Button1_Click" Text="ShowModulPopup" />
</itemtemplate>
</asp:templatefield>
</columns>
</asp:gridview>
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Style="display: none"
Width="233px">
Show Modal Popup!
<asp:Button ID="OkButton" runat="server" Text="OK" />
<asp:Button ID="CancelButton" runat="server" Text="Cancel" />
</asp:Panel>
<asp:button ID="Button3" runat="server" Text="Button" Style="display: none" />
<ajaxtoolkit:modalpopupextender ID="ModalPopupExtender1" runat="server" TargetControlID="Button3"
PopupControlID="Panel1" BackgroundCssClass="modalBackground" OkControlID="OkButton"
CancelControlID="CancelButton">
</ajaxtoolkit:modalpopupextender>
</div>
</form>
</body>
</html>
I look forward to receiving your test results.
Thomas Sun
Microsoft Online Community Support
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
![]() |
0 |
![]() |
hi
i have added Style="display: none" for panel1 so my panel1 dont display when page load.. when i click button1, my panel1 be displayed..
<asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" Style="display: none"
But when i click button1, page load again then my panel1 be displayed.. is there a way that without loading page for displaying panel1 ?
I have tried updatepanel for this(I put panel1 and button1 in updatepanel).. but my panel1 have been displayed below gridview1.. not center of page.aspx.. also CssClass doesnt be displayed..
Thanks
Mark as me if my question or my answer can be helpful for you :)
![]() |
0 |
![]() |
hi..
try putting target control and OK button outside the update panel..
start update panel inside the asp:panel and complete it before ok button..this is how i have done before and it works fine.
hope this helps you..
Rushik
(please mark as an answer, if this helps you.)
![]() |
0 |
![]() |