Friday, March 25, 2011

ModalPopupExteder – Ajax Control use in asp.net.


Default.aspx
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
    </div>
    <br />
    <asp:Button ID="Button1" runat="server" Text="Button" />  
    <cc1:ModalPopupExtender ID="Button1_ModalPopupExtender" runat="server"   
         CancelControlID="Button3" Enabled="True" PopupControlID="Panel1"   
         TargetControlID="Button1">
    </cc1:ModalPopupExtender>
    <asp:Panel ID="Panel1" runat="server" Width="50%">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server"
         UpdateMode="Conditional">
    <ContentTemplate>   
        <table style="width: 100%;" bgcolor="#FFCCFF">           
            <tr>
                <td>
                    Name
                </td>
                <td>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>               
                <td>
   <asp:Button ID="btn_submit" runat="server" OnClick="btn_submit_Click"
        Text="Submit" />&nbsp;
   <asp:Button ID="Button3" runat="server" Text="Cancel" />
   <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                </td>
            </tr>
        </table>
   
 </ContentTemplate>
    <Triggers>
    <asp:PostBackTrigger ControlID="Button3" />
    </Triggers>
    </asp:UpdatePanel>
    </asp:Panel>
    <br />
    </form>
</body>
</html>
Default.aspx.cs
protected void btn_submit_Click(object sender, EventArgs e)
    {
        Label1.Text = TextBox1.Text; 
    }

No comments:

Post a Comment