Breaking News

Editors Picks

Thursday, July 15, 2010

Model Popup with LinkButton in asp.net using Ajax

Code For .aspx Page


@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<!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 id="Head1" runat="server">   
    <%-- <script type="text/javascript">
    function fnClickUpdate(sender, e)
    {
        __doPostBack(sender,e);
    }
  
    </script>--%>
    <style type="text/css">
        TR.updated TD
        {
            background-color:#084067;
        }
        .modalBackground
        {
              background-color:Gray;
              filter:alpha(opacity=70);
              opacity:0.7;
        }
         .linkb
        {
        background-image:url(images/btnsms.png);
    
        }
        .linkb1
        {
        background-image:url(images/btnEmail.png);
   
        }
    </style>
</head>
<body style="background-color: White;">
    <form id="form1" runat="server">
        <div>
            <table border="0" align="center" cellpadding="0" cellspacing="0"        style="margin-top: 0;
                vertical-align: top; height: 702px;" bgcolor="#FFFFFF">
                <tr>
                    <td>
                        <table border="0" cellspacing="0" cellpadding="0" width="100%">
                            <tr valign="top">
                              
                                <td style="height: 136px">
                                    <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                        <tr>
                                            <td align="right" valign="top">
                                                <div class="toplink" style="background-image: url(http://fixmybrix.com/images/top_bg1.gif);
                                                    height: 24px; padding-top: 4px;">
<div class="flt"> <a href="http://UserRegistration.aspx">NewUser</a> /


/* Model Popup when click this button */

 <asp:LinkButton ID="lnkblogin" runat="server"  Text="Sign In" OnClick="lnkblogin_Click"></asp:LinkButton>                                                                                                         
 </div>
</div>
 </td>
</tr>
</table>
</td>
 </tr>
 </table>
 </td>
</tr>
 <tr>
<td style="height: 18px; width: 973px;">
<asp:Panel ID="pnlPopup" runat="server" CssClass="detail" Width="300px" Height="200px" Style="display: none;" BorderWidth="2px" BorderStyle="Solid" BorderColor="green" BackColor="#FFFFFF">
<cc1:ModalPopupExtender ID="mdlPopup" runat="server" TargetControlID="lnkblogin"
 PopupControlID="pnlPopup" CancelControlID="btnClose" BackgroundCssClass="modalBackground">
  </cc1:ModalPopupExtender>
 <div id="login" style="display: block;">
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
  <td valign="top" bgcolor="#ffffff">
  <div class="heading_login">
<img src="http://fixmybrix.com/images/bg-heading-arrow.gif" align="absMiddle" />Login</div>
 <form name="lgn_frm" method="post" action="http://user_login.aspx">
                                                <div class="content_login">
                                                    <div id="error" class="error">
                                                    </div>
                                                    <table width="320" border="0" cellspacing="0" cellpadding="2">
                                                        <tr>
                                                            <td align="right">
                                                                <input id="txtUserName" runat="server" class="input" type="text"  value="User Name" onfocus="if(this.value=='User Name'){ this.value=''; }"
                                                                    onblur="if(this.value==''){ this.value='User Name'; }" /></td>
                                                        </tr>
                                                        <tr>
                                                            <td align="right">
                                                                <input id="txtPassword" runat="server"  class="input" type="password"  value="Password" onfocus="if(this.value=='Password'){ this.value=''; }"
                                                                    onblur="if(this.value==''){ this.value='Password'; }" /></td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div class="btnb-lt">
                                                                </div>
                                                                <div class="btnb-rt">
                                                                      <asp:LinkButton ID="LinkButton2" runat="server" ForeColor="white" Font-Bold="true" Font-Size="Large" Width="59px"  >Login</asp:LinkButton>
</div>
                                                                <asp:Label ID="lblMessage" runat="server"></asp:Label>
                                                                <div style="margin-left: 10px; float: left; margin-top: 10px; font-size: 14px;">
                                                                    <a href="http://ForgetPassword.aspx"  class="grey" style="text-decoration: none;">
                                                                        Forgot Password</a> | <a href="http://UserRegistration.aspx"
                                                                            class="grey" style="text-decoration: none;">Register Now!</a></div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </form>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div id="forgot" style="display: none;">
                                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td valign="top" bgcolor="#ffffff">
                                            <div class="heading_login">
                                                <img src="http://fixmybrix.com/images/bg-heading-arrow.gif" align="absMiddle" />Forgot
                                                Password</div>
                                            <div class="content_login">
                                                <div id="error1" class="error">
                                                </div>
                                                <form name="forgot_frm" method="post" action="http://user_login.aspx">
                                                    <table width="320" border="0" cellspacing="0" cellpadding="2">
                                                        <tr>
                                                            <td align="right">
                                                                <input name="member_email" class="input" type="text" value="Enter your e-mail address"
                                                                    onfocus="if(this.value=='Enter your e-mail address'){ this.value=''; }" onblur="if(this.value==''){ this.value='Enter your e-mail address'; }" /></td>
                                                        </tr>
                                                        <tr>
                                                            <td>
                                                                <div class="btnb-lt">
                                                                </div>
                    <div class="btnb-rt">
                                                                   
                                                                    <input type="hidden" name="act" value="forgot" />
                                                                </div>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </form>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <div class="footer" >
                                &nbsp;<asp:ImageButton ID="btnClose" runat="server" ImageAlign="Right" ImageUrl="~/fixControl/closelabel.gif"  CausesValidation="false"
                                    Width="48px" />
                            </div>
                        </asp:Panel>
                    </td>
                </tr>             
               
            </table>
        </div>
    </form>
</body>
</html>



Code for aspx.cs page

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using OfferaTech.Framework.Metatags;

public partial class MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
       
    }


    protected void lnkblogin_Click(object sender, EventArgs e)
    {
       
            mdlPopup.Show();
       
    }

   

}

2 comments :

Contact Us

Name

Email *

Message *