Wednesday, 26 September 2012

Ajax model pop up


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="samplemodel.aspx.cs" Inherits="vScreenSite.pages.samplemodel" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">

.ModalPopupBG
{
    background-color: #666699;
    filter: alpha(opacity=50);
    opacity: 0.7;
}

.HellowWorldPopup
{
    min-width:200px;
    min-height:150px;
    background:white;
}
    </style>
</head>
<body>
    <form id="form1" runat="server">
 <cc1:ToolkitScriptManager ID="tlkt1" runat="server">
                </cc1:ToolkitScriptManager>
<%--<asp:button id="Button1" runat="server" text="Button" />--%>

<%--<cc1:modalpopupextender id="ModalPopupExtender1" runat="server"
cancelcontrolid="btnCancel" okcontrolid="btnOkay"
targetcontrolid="Button1" popupcontrolid="Panel1"
popupdraghandlecontrolid="PopupHeader" drag="true"
backgroundcssclass="ModalPopupBG">
</cc1:modalpopupextender>--%>



<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <asp:Button ID="btnLogin1" runat="server" Text="Already have an account? Log in." OnClick="btnLogin1_Click" />
        <asp:Button ID="BtnTarget" runat="server" Text="Target" Style="display: none" />
       
        <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="BtnTarget"
            PopupControlID="Panel1">
        </cc1:ModalPopupExtender>
        <asp:Panel ID="Panel1" runat="server" BackColor="WhiteSmoke" Width="300px" Height="200px">
            <asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
                <ContentTemplate>
                <table>
                <tr>
                <td>
                    <asp:Label ID="lblEmail" runat="server" Text="enter id value"></asp:Label>
                </td>
                <td>
                 <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
                </td>
                 
                </tr>
                <tr>
                <td><asp:Label ID="lblPassword" runat="server" Text="enter pass value"></asp:Label>
             
                </td>
                <td><asp:TextBox ID="txtPassword" runat="server"></asp:TextBox>
                </td>
                </tr>
                </table>
                <asp:Label ID="lbl" runat="server" ></asp:Label>
               
                    <asp:Button ID="btnLogin" runat="server" Text="Login" OnClick="btnLogin_Click" />
                </ContentTemplate>
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="btnLogin" EventName="Click" />
                </Triggers>
            </asp:UpdatePanel>
        </asp:Panel>
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnLogin1" EventName="Click" />
    </Triggers>
</asp:UpdatePanel>
    </form>
</body>
</html>

codebehind file code

    protected void btnLogin1_Click(object sender, EventArgs e)
        {
            ModalPopupExtender1.Show();
            txtEmail.Text = "sai";
            txtPassword.Text = "babu";
     
        }
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            if (txtEmail.Text == "sai" && txtPassword.Text == "babu")
            {
                Response.Redirect("child_login.aspx");
            }
            else
            {
                ModalPopupExtender1.Show();
                lbl.Text = txtEmail.Text;
            }
          //  Response.Write(TextBox1.Text+" and "+TextBox2.Text);
          //  Response.Redirect("child_login.aspx");
        }
    }



No comments:

Post a Comment