Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi i have a web user control LoginControl.ascx, and a userinfo page on which I have two radio button "yes" and "no" for choice for complete your profile now or later
if user select "yes" then a panel be visible for fill the detail and all other things be unvisible using java script when user click on submit ,all information saved in database and this panel does hide and panel of logincontrol(in this panel my logincontrol.ascx is exist) is visible when user log in then it is working but when user click on " no " radio button then use control not working means it's "login" button or "new user" button is not firing any event.

please help me .. i am sharing my code

This is source of web user control
ASP.NET
<asp:Panel ID= "panellogin"  runat="server" Width="324px">
                <table id="tbllogin" cellpadding="5" cellspacing="5"  ><tr><td class="style2"
                        colspan="2">Please&nbsp; Login here&nbsp; </td></tr>
                <tr><td class="style2">Email Address</td><td class="style1"><asp:TextBox ID= "txtlogin" runat="server"></asp:TextBox></td></tr>
                <tr><td class="style2">Password</td><td class="style1"><asp:TextBox ID= "txtpswrd" runat="server"></asp:TextBox></td></tr><tr>
                    <td class="style2"></td><td class="style1">&nbsp;<asp:Button ID="btnlogin"
                        runat="server" Text="Login" onclick="btnlogin_Click"/>
                    <asp:Button ID="btnnewuser" runat="server" onclick="btnnewuser_Click"
                        Text="New User" />
                    </td></tr>
                </table></asp:Panel>

this is code behind of LoginControl(user control)
C#
protected void btnlogin_Click(object sender, EventArgs e)
{
    dbManager.ConnectionString = ConfigurationSettings.AppSettings["Connectionstring"].ToString();
    dbManager.Open();
    dbManager.CreateParameters(2);
    dbManager.AddParameters(0, "@email",  txtlogin.Text);
    dbManager.AddParameters(1, "@pass", txtpswrd.Text);
    DataSet ds=  dbManager.ExecuteDataSet(CommandType.Text, "select * from UserAccount where Email=@email and Password=@pass");
    if (ds.Tables[0].Rows.Count == 0)
    {
        Response.Write("please enter valid email or passwor");
    }
    else
    {
        Response.Redirect("Trainer/TProfile.aspx");
    }
}

protected void btnnewuser_Click(object sender, EventArgs e)
{
    Response.Redirect("Register.aspx");
}

Now this code is for userinfo.aspx page
ASP.NET
<%@ Page Title="" Language="C#" MasterPageFile="~/Completeprofile.master" AutoEventWireup="true" CodeFile="userinfo.aspx.cs" Inherits="userinfo" %>
<%@ Register TagPrefix="uc" TagName="Spinner" 
    Src="~/LoginControl.ascx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
      <script type="text/javascript" language="javascript">
          function showhidepanel(rad) {
              if (document.getElementById(rad.id + '_0').checked) {
                  document.getElementById('ContentPlaceHolder1_profilepanel').style.display = 'inline';
                  document.getElementById('ContentPlaceHolder1_panellogin').style.display = 'none'
              }
              if (document.getElementById(rad.id + '_1').checked) {
                  document.getElementById('rowprofile').style.display = 'none';
                  document.getElementById('ContentPlaceHolder1_profilepanel').style.display = 'none';
                  document.getElementById('ContentPlaceHolder1_panellogin').style.display = 'inline';
              }

          }
          function showlogin() {
              //  document.getElementById('ContentPlaceHolder1_profilepanel').style.display = 'none'

              document.getElementById('tbll').style.display = 'none';
              document.getElementById('ContentPlaceHolder1_panellogin').style.display = 'inline';
              
          }
      </script> 
       
       <div class="article">
          <h2><span style="text-decoration: underline; color: #1CA2CE">family</span></h2></div>
                 
    <div class="fbg">
<div class="fbg_resize">
    <div>
        <table style="width: 100%" cellpadding="5" cellspacing="5" id="tbll">
        

            <tr id="rowprofile" style="display:inline">
                <td>
                    Dear
                    <asp:Label ID="username" runat="server" Text="Label">
 Please Complete your profile<asp:Label ID="lblmsg" runat="server" ForeColor="Red" 
                        Text="Label" Visible="False">
                </td>
            </tr>
            <tr><td>Would you like to complete your profile now ?</td><td> <asp:RadioButtonList ID="rbl1" RepeatDirection="Horizontal" runat="server" onclick="showhidepanel(this);" >
<asp:ListItem Value="Yes">Yes
<asp:ListItem Value="No">No</td></tr>
</table> 
  <asp:Panel ID ="profilepanel" runat="server" style="display:none">  
                  
            <table cellpadding="5" cellspacing="5">
                        style="border-style: outset; width: 100%"><tr>
                    <td style="width: 137px">
                        Education</td>
                    <td>
                        <asp:TextBox ID="txteducatn" runat="server" 
                            ontextchanged="txteducatn_TextChanged">
                        <asp:RequiredFieldValidator ID="reqedu" runat="server" 
                            ControlToValidate="txteducatn" ErrorMessage="Education req" Font-Size="Smaller" 
                            ForeColor="Red">
                        <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" 
                             runat="server" TargetControlID="reqedu">
                        
                    </td></tr>
                        <tr>
                            <td style="width: 137px">
                                Certification</td>
                            <td>
                                <asp:TextBox ID="txtcertification" runat="server">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 137px">
                                Experience</td>
                            <td>
                                <asp:TextBox ID="txtexprnc" runat="server">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 137px">
                                Second Email</td>
                            <td>
                                <asp:TextBox ID="txtscndemail" runat="server">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 137px">
                                Other Contact</td>
                            <td>
                                <asp:TextBox ID="txtcntact" runat="server">
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 137px">
                                DOB</td>
                            <td>
                         
                                <asp:TextBox ID="TXTDOB" runat="server">
                                <ajaxToolkit:CalendarExtender ID="clndrdob"  runat="server" TargetControlID="TXTDOB">
                                   <asp:RequiredFieldValidator ID="dobreq" runat="server" 
                                    ErrorMessage="DOB Req" ControlToValidate="TXTDOB" 
                                    Font-Size="Smaller" ForeColor="Red">
                                <ajaxToolkit:ValidatorCalloutExtender ID="ValidatorCalloutExtender2"  runat="server" TargetControlID="dobreq">
                                
                                
                             <%--   <ajaxToolkit:CalendarExtender ID="CalendarExtender1"  runat="server" TargetControlID="txtdate" PopupButtonID="image1"  >
                                
                                <img id="image1"  runat="server" src="~/images/calendar.png" alt="" />--%>
                            </td>
                            
                        </tr>
                        <tr><td>Upload your profile pic</td><td>
                                <asp:FileUpload ID="prflupload" runat="server" />
                                </td></tr>
                         <tr><td></td><td>
                <asp:Button ID="submit"  Text="Submit"  onclick="submit_Click" runat="server"/></td></tr>
                    </table> 
               
                <asp:Panel ID="panel2" runat="server" style="display:none">
        
                <asp:Panel ID= "panellogin"  runat="server" >
                <uc:Spinner id="Spinner1" 
         runat="server" 
        MinValue="1" 
        MaxValue="10" />       
           </div> 
    </div>
        
  </div>

Please help me Thanks to all of you in advance
friends give me solution please
Posted
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900