Want to show popup on Click of serverside button control using ModalPopupExtender in Ajax

Posted by Navalemanoj0405 under ASP.NET AJAX on 5/11/2011 | Points: 10 | Views : 4007 | Status : [Member] | Replies : 1
Dear All
Want to show popup on Click of serverside button control using ModalPopupExtender in Ajax
When I will click on button, controls on popup control should fill with some values
any solution for this problem?

please help me.

thanks in adv.

protected void Page_Load(object sender, EventArgs e)
{
//if (!Page.IsPostBack)
//{

//}
}

protected void Button1_Click(object sender, EventArgs e)
{
lbl1.Text = TextBox1.Text;
Label1.Text = TextBox2.Text;
Label2.Text = TextBox3.Text;
ModalPopupExtender1.Show();
}

this is source code:

<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Ok" />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server" Text="Cancel" />
<asp:Panel ID="Panel1" runat="server" BackColor="#ffffff" BorderColor="#dadada" BorderStyle="Solid"
BorderWidth="4px" Height="190px" Width="350px" Font-Names="Arial" Font-Size="10pt">
<table cellpadding="10" cellspacing="0" style="width: 100%">
<tr>
<td>
1
<asp:Label ID="lbl1" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
2
<asp:Label ID="Label1" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
3
<asp:Label ID="Label2" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button3" runat="server" Text="Submit" />
<asp:Button ID="Button4" runat="server" Text="Cancel" />
</td>
</tr>
</table>
</asp:Panel>
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1"
DropShadow="True" TargetControlID="Button1" CancelControlID="Button4" BackgroundCssClass="BackgroundStyle" />
</div>





Responses

Posted by: Ndebata on: 5/11/2011 [Member] Starter | Points: 25

Up
0
Down
Hi

Please take a look at the sample, where that button is inside a grid, it can be any thing you just need call the Show() method of modalpopupextender, ofcourse you need to populate the data before calling the show method on modalpopupextender.

Thanks,
Debata
 Download source file

Navalemanoj0405, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response