Tuesday, April 17, 2012

ModalPopUp from serverside in Asp.Net (C#)

In the previous post to show modal popup from server side a lot of coding is given. Insted of writing a lenthy code here is a simple code to work the same as follows.

To use ModalPopupExtender to work from Server Side Code is quite simple once we know how the control can be triggered from the given code. Here we need to take a dummy control for the targetcontrokid for the ModalPopupExtender.

I used ASP.NET hiddenfield.


<asp:Button ID="btn1" runat="server" btn1_Click/>
<asp:HiddenField ID="HF1" runat="server" />

PopupControlID="pnlShow" >

<asp:Panel ID="pnlShow" runat="server"  BorderStyle="Outset" BorderWidth="2" Width="300px"  Height="150px">    
          <h2> Information Panel</h2>

C# Code :-

within buton click write below line.

No comments:

Post a Comment