0

ログイン用のJQuerySilderパネルがあります| オプションを登録します。参照用に、このスライダーのデモを含めましたJquery Login | スライダーパネルの登録

実際の問題は、リテラルコントロールがログインセクションまたは新規アカウントの登録セクションに値を持っているときに、このスライダーをプログラムで拡張する方法でした。この問題を理解するために、私は自分のデザインコードを入れました。

    <asp:Panel ID="Panel_Login_Register" runat="server" CssClass="Panel_Slide">
    <div id="toppanel">
    <div id="panel">
        <div class="content clearfix">
            <asp:Panel ID="Panel_Welcome" runat="server" CssClass="left">
                <h1>Welcome to Om Investment</h1>
                <p class="grey">Om Investment Stock Market Research Trading &amp; Advisory, the most successful market
                trading team and has predicted the market direction always ahead of others, our
                powerful and high volume Market Gains trading team will deliver high returns to
                the Capital invested by clients, We have a consistent success ratio genuine more than
                80% in every type of Market.</p>
            </asp:Panel>
            <asp:Panel ID="Panel_Login" runat="server" CssClass="left" Width="200px" DefaultButton="btnlogin">
                    <h1>Member Login</h1>
                     <asp:Label ID="Label2" runat="server" Text="Username:" CssClass="grey" AssociatedControlID="txtusername"></asp:Label>
                      <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender4" runat="server" TargetControlID="txtusername" WatermarkText="Enter username here"/>
                    <asp:TextBox ID="txtusername" runat="server" CssClass="field" ValidationGroup="Login"></asp:TextBox>
                  <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="<span style='color:Black'><b>Required Field Missing</b><br />Username is required.</span>"
                                                ControlToValidate="txtusername" ValidationGroup="Login" Display="None" SetFocusOnError="true"></asp:RequiredFieldValidator>
                                            <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" TargetControlID="RequiredFieldValidator2"
                                                Width="200px" HighlightCssClass="highlight" WarningIconImageUrl="images/1329542890_dialog-warning.png"
                                                CloseImageUrl="images/close.gif">
                                            </cc1:ValidatorCalloutExtender>
                    <asp:Label ID="Label3" runat="server" Text="Password:" CssClass="grey" AssociatedControlID="txtpassword"></asp:Label>
                     <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender12" runat="server" TargetControlID="txtpassword"
                                                WatermarkText="123456789"/>
                    <asp:TextBox ID="txtpassword" runat="server" CssClass="field" ValidationGroup="Login" TextMode="Password"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="<span style='color:Black'><b>Required Field Missing</b><br />Password is required.</span>"
                                                    ControlToValidate="txtpassword" ValidationGroup="Login" Display="None"></asp:RequiredFieldValidator>
                                            <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender3" runat="server" TargetControlID="RequiredFieldValidator3"
                                                Width="200px" HighlightCssClass="highlight" WarningIconImageUrl="images/1329542890_dialog-warning.png"
                                                CloseImageUrl="images/close.gif">
                                            </cc1:ValidatorCalloutExtender><br />
                    <asp:CheckBox ID="chk_remember" runat="server"/>&nbsp;<asp:Label ID="Label4" runat="server" Text="Remeber Me ?" CssClass="grey"></asp:Label>
                    <div class="clear"></div>
                    <asp:Button ID="btnlogin" runat="server" Text="Login" CssClass="bt_login" ValidationGroup="Login" OnClick="btnlogin_Click" />
                    <a class="lost-pwd" href="password_recover.aspx"> Lost your password ?</a>
                    <div class="clear"></div>
                    <p class="grey"><asp:Literal ID="ltr_error" runat="server"></asp:Literal></p>
            </asp:Panel>
     <asp:Panel ID="Panel_Register" runat="server" CssClass="left right" DefaultButton="btn_register" Width="356px">            
                    <h1>Create New Account</h1>             
      <p class="grey">(All the fields are compulsory)</p>
           <table><tr><td><asp:Label id="Label6" runat="server" Text="Your Name*" AssociatedControlID="txtname" CssClass="grey"></asp:Label> <cc1:TextBoxWatermarkExtender id="TextBoxWatermarkExtender5" watermarkText="Enter your name" runat="server" TargetControlID="txtname">
              </cc1:TextBoxWatermarkExtender> <cc1:FilteredTextBoxExtender id="FilteredTextBoxExtender2" runat="server" TargetControlID="txtname" ValidChars=" ,." FilterType="UppercaseLetters,LowercaseLetters,Custom">
              </cc1:FilteredTextBoxExtender></td></tr>
              <tr><td><asp:TextBox id="txtname" runat="server" CssClass="field" ValidationGroup="SignUp" MaxLength="50"></asp:TextBox> <asp:RequiredFieldValidator id="RequiredFieldValidator5" runat="server" ValidationGroup="SignUp" SetFocusOnError="true" Display="None" ControlToValidate="txtname" ErrorMessage="<span style='color:Black'><b>Required Field Missing</b><br />Your name is required.</span>"></asp:RequiredFieldValidator> <cc1:ValidatorCalloutExtender id="ValidatorCalloutExtender4" runat="server" TargetControlID="RequiredFieldValidator5" Width="200px" CloseImageUrl="images/close.gif" WarningIconImageUrl="images/1329542890_dialog-warning.png" HighlightCssClass="highlight">
                        </cc1:ValidatorCalloutExtender></td></tr>                                      
            <tr><td><asp:Label id="Label7" runat="server" Text="Your Username*" AssociatedControlID="txtusername1" CssClass="grey"></asp:Label> <cc1:TextBoxWatermarkExtender id="TextBoxWatermarkExtender6" watermarkText="Enter your username" runat="server" TargetControlID="txtusername1">
            </cc1:TextBoxWatermarkExtender> <cc1:FilteredTextBoxExtender id="FilteredTextBoxExtender3" runat="server" TargetControlID="txtusername" FilterType="UppercaseLetters,LowercaseLetters,Numbers,Custom">
              </cc1:FilteredTextBoxExtender></td></tr>
             <tr><td><asp:TextBox id="txtusername1" runat="server" CssClass="field" ValidationGroup="SignUp" MaxLength="50"></asp:TextBox><asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="txtusername1" OnServerValidate="CustomValidator1_ServerValidate" SetFocusOnError="True" ValidationGroup="SignUp" CssClass="grey" ErrorMessage="<span style='color:Gray'>Username is already exist</span>"></asp:CustomValidator></td></tr>
             <tr><td><asp:RequiredFieldValidator id="RequiredFieldValidator6" runat="server" ValidationGroup="SignUp" SetFocusOnError="true" Display="None" ControlToValidate="txtusername1" ErrorMessage="<span style='color:Black'><b>Required Field Missing</b><br />Your username is required.</span>"></asp:RequiredFieldValidator> <cc1:ValidatorCalloutExtender id="ValidatorCalloutExtender7" runat="server" TargetControlID="RequiredFieldValidator6" Width="200px" CloseImageUrl="images/close.gif" WarningIconImageUrl="images/1329542890_dialog-warning.png" HighlightCssClass="highlight">
                                                      </cc1:ValidatorCalloutExtender></td></tr>
             <tr><td><asp:Label id="Label9" runat="server" Text="Your Account Password*" AssociatedControlID="txtpass" CssClass="grey"></asp:Label> <cc1:FilteredTextBoxExtender id="FilteredTextBoxExtender4" runat="server" TargetControlID="txtpass" ValidChars="." FilterType="UppercaseLetters,LowercaseLetters,Numbers,Custom" InvalidChars=" ,'">
              </cc1:FilteredTextBoxExtender> <cc1:TextBoxWatermarkExtender id="TextBoxWatermarkExtender7" watermarkText="1234567890" runat="server" TargetControlID="txtpass">
            </cc1:TextBoxWatermarkExtender></td></tr>
            <tr><td><asp:TextBox id="txtpass" runat="server" CssClass="field" ValidationGroup="SignUp" MaxLength="15" TextMode="Password"></asp:TextBox> <cc1:PasswordStrength id="PasswordStrength1" runat="server" TargetControlID="txtpass" RequiresUpperAndLowerCaseCharacters="false" MinimumSymbolCharacters="0" MinimumNumericCharacters="0" StrengthStyles="TextIndicator_TextBox1_Strength1;TextIndicator_TextBox1_Strength2;TextIndicator_TextBox1_Strength3;TextIndicator_TextBox1_Strength4;TextIndicator_TextBox1_Strength5" TextStrengthDescriptions="Very Poor;Weak;Average;Strong;Excellent" HelpStatusLabelID="TextBox1_HelpLabel" PrefixText="Strength:" PreferredPasswordLength="10" StrengthIndicatorType="Text" DisplayPosition="RightSide"></cc1:PasswordStrength> <asp:RequiredFieldValidator id="RequiredFieldValidator7" runat="server" ValidationGroup="SignUp" SetFocusOnError="true" Display="None" ControlToValidate="txtpass" ErrorMessage="<span style='color:Black'><b>Required Field Missing</b><br />Your account password is required.</span>"></asp:RequiredFieldValidator> <cc1:ValidatorCalloutExtender id="ValidatorCalloutExtender8" runat="server" TargetControlID="RequiredFieldValidator7" Width="200px" CloseImageUrl="images/close.gif" WarningIconImageUrl="images/1329542890_dialog-warning.png" HighlightCssClass="highlight">
                                                       </cc1:ValidatorCalloutExtender></td></tr>
            <tr><td><asp:Label id="Label10" runat="server" Text="Confirm Password*" AssociatedControlID="txtcpass" CssClass="grey"></asp:Label><cc1:TextBoxWatermarkExtender id="TextBoxWatermarkExtender8" watermarkText="1234567890" runat="server" TargetControlID="txtcpass">
            </cc1:TextBoxWatermarkExtender> <cc1:FilteredTextBoxExtender id="FilteredTextBoxExtender5" runat="server" TargetControlID="txtpass" ValidChars="." FilterType="UppercaseLetters,LowercaseLetters,Numbers,Custom" InvalidChars=" ,'">
              </cc1:FilteredTextBoxExtender></td></tr>
            <tr><td><asp:TextBox id="txtcpass" runat="server" CssClass="field" ValidationGroup="SignUp" MaxLength="15" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator id="RequiredFieldValidator8" runat="server" ValidationGroup="SignUp" SetFocusOnError="true" Display="None" ControlToValidate="txtcpass" ErrorMessage="<span style='color:Black'><b>Required Field Missing</b><br />Confirm password is required.</span>"></asp:RequiredFieldValidator> <asp:CompareValidator id="CompareValidator1" runat="server" ValidationGroup="SignUp" SetFocusOnError="true" Display="None" ControlToValidate="txtcpass" ErrorMessage="<span style='color:Black'><b>Entered Field is Invalid</b><br />Your new password and confirm password doesn't mathched.</span>" ControlToCompare="txtpass"></asp:CompareValidator> <cc1:ValidatorCalloutExtender id="ValidatorCalloutExtender9" runat="server" TargetControlID="RequiredFieldValidator8" Width="200px" CloseImageUrl="images/close.gif" WarningIconImageUrl="images/1329542890_dialog-warning.png" HighlightCssClass="highlight">
                                                       </cc1:ValidatorCalloutExtender> <cc1:ValidatorCalloutExtender id="ValidatorCalloutExtender11" runat="server" TargetControlID="CompareValidator1" Width="200px" CloseImageUrl="images/close.gif" WarningIconImageUrl="images/1329542890_dialog-warning.png" HighlightCssClass="highlight">
                                                       </cc1:ValidatorCalloutExtender></td></tr>
          <tr><td><asp:Label id="Label12" runat="server" Text="Your Birth Date*" AssociatedControlID="txtbdate" CssClass="grey"></asp:Label> <cc1:TextBoxWatermarkExtender id="TextBoxWatermarkExtender10" watermarkText="Enter your birthdate" runat="server" TargetControlID="txtbdate">
          </cc1:TextBoxWatermarkExtender></td></tr>
          <tr><td><asp:TextBox id="txtbdate" runat="server" CssClass="field" ValidationGroup="SignUp"></asp:TextBox> <asp:RequiredFieldValidator id="RequiredFieldValidator10" runat="server" ValidationGroup="SignUp" SetFocusOnError="true" Display="None" ControlToValidate="txtbdate" ErrorMessage="<span style='color:Black'><b>Required Field Missing</b><br />Your birthdate is required.</span>"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator id="RegularExpressionValidator3" runat="server" ValidationGroup="SignUp" SetFocusOnError="true" Display="None" ControlToValidate="txtbdate" ErrorMessage="<span style='color:Black'><b>Entered Field is Invalid</b><br/>Birth date format should be like: DD/MM/yyyy</span>" ValidationExpression="^(((0[1-9]|[12]\d|3[01])\/(0[13578]|1[02])\/((19|[2-9]\d)\d{2}))|((0[1-9]|[12]\d|30)\/(0[13456789]|1[012])\/((19|[2-9]\d)\d{2}))|((0[1-9]|1\d|2[0-8])\/02\/((19|[2-9]\d)\d{2}))|(29\/02\/((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))))$"></asp:RegularExpressionValidator> <cc1:CalendarExtender id="CalendarExtender1" runat="server" TargetControlID="txtbdate" PopupButtonID="img_cal" Format="dd/MM/yyyy">
              </cc1:CalendarExtender> <cc1:MaskedEditExtender id="MaskedEditExtender5" runat="server" TargetControlID="txtbdate" ErrorTooltipEnabled="True" AcceptNegative="Left" DisplayMoney="Left" MaskType="Date" OnInvalidCssClass="MaskedEditError" OnFocusCssClass="MaskedEditFocus" MessageValidatorTip="true" Mask="99/99/9999"></cc1:MaskedEditExtender> <cc1:ValidatorCalloutExtender id="ValidatorCalloutExtender13" runat="server" TargetControlID="RequiredFieldValidator10" Width="200px" CloseImageUrl="images/close.gif" WarningIconImageUrl="images/1329542890_dialog-warning.png" HighlightCssClass="highlight">
                                                       </cc1:ValidatorCalloutExtender> <cc1:ValidatorCalloutExtender id="ValidatorCalloutExtender14" runat="server" TargetControlID="RegularExpressionValidator3" Width="200px" CloseImageUrl="images/close.gif" WarningIconImageUrl="images/1329542890_dialog-warning.png" HighlightCssClass="highlight">
                                                       </cc1:ValidatorCalloutExtender></td></tr>
          <tr><td><asp:Label id="Label11" runat="server" Text="Your e-mail*" AssociatedControlID="txtemail" CssClass="grey"></asp:Label><cc1:TextBoxWatermarkExtender id="TextBoxWatermarkExtender9" watermarkText="Enter your email" runat="server" TargetControlID="txtemail">
          </cc1:TextBoxWatermarkExtender></td></tr>
          <tr>
          <td><asp:TextBox id="txtemail" runat="server" CssClass="field" ValidationGroup="SignUp" MaxLength="50"></asp:TextBox><asp:CustomValidator ID="CustomValidator2" runat="server" ValidationGroup="SignUp" ControlToValidate="txtemail" SetFocusOnError="true" OnServerValidate="CustomValidator2_ServerValidate" CssClass="grey" ErrorMessage="<span style='color:Gray'>Email is already exist</span>"></asp:CustomValidator></td></tr>
          <tr><td><asp:RequiredFieldValidator id="RequiredFieldValidator9" runat="server" ValidationGroup="SignUp" SetFocusOnError="true" Display="None" ControlToValidate="txtemail" ErrorMessage="<span style='color:Black'><b>Required Field Missing</b><br />Your email is required.</span>"></asp:RequiredFieldValidator> <asp:RegularExpressionValidator id="RegularExpressionValidator2" runat="server" ValidationGroup="SignUp" SetFocusOnError="true" Display="None" ControlToValidate="txtemail" ErrorMessage="<span style='color:Black'><b>Entered Field is Invalid</b><br/>Email format should be like: name@domain.com</span>" ValidationExpression="^[\w-\.]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]{2,6}$"></asp:RegularExpressionValidator> <cc1:ValidatorCalloutExtender id="ValidatorCalloutExtender10" runat="server" TargetControlID="RequiredFieldValidator9" Width="200px" CloseImageUrl="images/close.gif" WarningIconImageUrl="images/1329542890_dialog-warning.png" HighlightCssClass="highlight">
                                                       </cc1:ValidatorCalloutExtender> <cc1:ValidatorCalloutExtender id="ValidatorCalloutExtender12" runat="server" TargetControlID="RegularExpressionValidator2" Width="200px" CloseImageUrl="images/close.gif" WarningIconImageUrl="images/1329542890_dialog-warning.png" HighlightCssClass="highlight">
                                                       </cc1:ValidatorCalloutExtender></td></tr>
          <tr><td><asp:Label id="Label13" runat="server" Text="Your Phone no*" AssociatedControlID="txtphoneno" CssClass="grey"></asp:Label> <cc1:TextBoxWatermarkExtender id="TextBoxWatermarkExtender11" watermarkText="Enter your phone no" runat="server" TargetControlID="txtphoneno">
          </cc1:TextBoxWatermarkExtender> <cc1:FilteredTextBoxExtender id="FilteredTextBoxExtender6" runat="server" TargetControlID="txtphoneno" FilterType="Numbers">
              </cc1:FilteredTextBoxExtender></td></tr>
          <tr>
          <td><asp:TextBox id="txtphoneno" runat="server" CssClass="field" ValidationGroup="SignUp" MaxLength="10"></asp:TextBox><asp:CustomValidator ID="CustomValidator3" runat="server" ValidationGroup="SignUp" ControlToValidate="txtphoneno" SetFocusOnError="true" OnServerValidate="CustomValidator3_ServerValidate" CssClass="grey" ErrorMessage="<span style='color:Gray'>Phone no is already exist</span>"></asp:CustomValidator></td>
          </tr>
          <tr><td><asp:RequiredFieldValidator id="RequiredFieldValidator11" runat="server" ValidationGroup="SignUp" SetFocusOnError="true" Display="None" ControlToValidate="txtphoneno" ErrorMessage="<span style='color:Black'><b>Required Field Missing</b><br />Your phone no is required.</span>"></asp:RequiredFieldValidator><asp:RegularExpressionValidator id="RegularExpressionValidator4" runat="server" ValidationGroup="SignUp" SetFocusOnError="true" Display="None" ControlToValidate="txtphoneno" ErrorMessage="<span style='color:Black'><b>Entered Field is Invalid</b><br/>Phone no format should like : 9000000098<br/> +91 Not Needed<span>" ValidationExpression="^((\\+91-?)|0)?[0-9]{10}$"></asp:RegularExpressionValidator> <cc1:ValidatorCalloutExtender id="ValidatorCalloutExtender15" runat="server" TargetControlID="RequiredFieldValidator11" Width="200px" CloseImageUrl="images/close.gif" WarningIconImageUrl="images/1329542890_dialog-warning.png" HighlightCssClass="highlight">
                                                       </cc1:ValidatorCalloutExtender> <cc1:ValidatorCalloutExtender id="ValidatorCalloutExtender16" runat="server" TargetControlID="RegularExpressionValidator4" Width="200px" CloseImageUrl="images/close.gif" WarningIconImageUrl="images/1329542890_dialog-warning.png" HighlightCssClass="highlight">
                                                       </cc1:ValidatorCalloutExtender></td></tr>
           <tr><td><asp:Button ID="btn_register" runat="server" Text="Register" ValidationGroup="SignUp" CssClass="bt_register" OnClick="btn_register_Click"/></td></tr>
          </table>
          <div class="clear"></div>
          <p class="grey"><asp:Literal ID="ltr_message2" runat="server"></asp:Literal></p>
         </asp:Panel>
        </div>
</div>
    <div class="tab">
        <ul class="login">
            <li class="left">&nbsp;</li>
            <li>Hello Guest!</li><li class="sep">|</li><li id="toggle">
                <a id="open" class="open" href="#">Log In | Register</a>
                <a id="close" style="display: none;" class="close" href="#">Close Panel</a>         
            </li>
            <li class="right">&nbsp;</li>
        </ul> 
    </div> 
</div>
 </asp:Panel>

このスライダーは正常に機能しますが、リテラルの1つに値がある場合に、このパネルを自動拡張する方法がわかりません。

[新規アカウントの登録]パネルには、カスタムバリデーターもあります。また、3つのカスタムバリデーターの1つがエラーメッセージをスローした場合に、このパネルを拡張する方法を見つける必要があります。

参照の詳細については、js/slide.jsファイルの内容も含まれています。

$(document).ready(function() {

    // Expand Panel
    $("#open").click(function(){
        $("div#panel").slideDown("slow");

    }); 

    // Collapse Panel
    $("#close").click(function(){
        $("div#panel").slideUp("slow"); 
    });     

    // Switch buttons from "Log In | Register" to "Close Panel" on click
    $("#toggle a").click(function () {
        $("#toggle a").toggle();
    });     

});

_ __ _ __ _ __ _ __ _ __ _ _____更新されたコード_____ _ __ _ __ _ __ _ __ _ __ _ このコードは、リテラル制御にカスタムエラーを追加する方法に関するものです

protected void btnlogin_Click(object sender, EventArgs e)
{
    if (Page.IsValid)
    {

        using (SqlConnection conn = Util.GetConnection())
        {
            conn.Open();
            SqlCommand cmd = new SqlCommand("sp_CheckUserAccount", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@UserName", SqlDbType.VarChar).Value = txtusername.Text.Trim();
            cmd.Parameters.Add("@pass", SqlDbType.VarChar).Value = txtpassword.Text.Trim();
            cmd.Parameters.Add("@Error", SqlDbType.NVarChar, 100).Direction = ParameterDirection.Output;
            SqlParameter sqlParam = cmd.Parameters.Add("@Return Value", SqlDbType.Int);
            sqlParam.Direction = System.Data.ParameterDirection.ReturnValue;
            cmd.ExecuteNonQuery();
            int returnValue = (int)cmd.Parameters["@Return Value"].Value;
            if (returnValue == 1)
            {
                if (chk_remember.Checked == true)
                {
                    conn.Close();
                    cmd.Dispose();
                    conn.Open();
                    SqlCommand cmd1 = new SqlCommand("sp_Read_User_Type", conn);
                    cmd1.CommandType = CommandType.StoredProcedure;
                    cmd1.Parameters.Add(new SqlParameter("@Userid", SqlDbType.VarChar, 50, "Id"));
                    cmd1.Parameters["@Userid"].Value = txtusername.Text.Trim();
                    SqlDataReader reader = cmd1.ExecuteReader();
                    while (reader.Read())
                    {
                        if (reader["Type_name"].ToString() == "Admin")
                        {
                            Response.Cookies["UName"].Value = txtusername.Text;
                            Response.Cookies["PWD"].Value = txtpassword.Text;
                            Response.Cookies["UName"].Expires = DateTime.Now.AddMonths(2);
                            Response.Cookies["PWD"].Expires = DateTime.Now.AddMonths(2);
                            Session["username"] = reader["Id"].ToString();
                            Response.Redirect("~/Admin/Admin_Landing_page.aspx");
                        }
                        else
                        {
                            Response.Cookies["UName"].Value = txtusername.Text;
                            Response.Cookies["PWD"].Value = txtpassword.Text;
                            Response.Cookies["UName"].Expires = DateTime.Now.AddMonths(2);
                            Response.Cookies["PWD"].Expires = DateTime.Now.AddMonths(2);
                            Session["username"] = reader["Id"].ToString();
                            Response.Redirect("~/EndUser/myhome.aspx");
                        }
                    }
                    reader.Close();
                }
                else
                {
                    Response.Cookies["UName"].Expires = DateTime.Now.AddMonths(-1);
                    Response.Cookies["PWD"].Expires = DateTime.Now.AddMonths(-1);
                    conn.Close();
                    cmd.Dispose();
                    conn.Open();
                    SqlCommand cmd1 = new SqlCommand("sp_Read_User_Type", conn);
                    cmd1.CommandType = CommandType.StoredProcedure;
                    cmd1.Parameters.Add(new SqlParameter("@Userid", SqlDbType.VarChar, 50, "Id"));
                    cmd1.Parameters["@Userid"].Value = txtusername.Text.Trim();
                    SqlDataReader reader = cmd1.ExecuteReader();
                    while (reader.Read())
                    {
                        if (reader["Type_name"].ToString() == "Admin")
                        {
                            Session["username"] = reader["Id"].ToString();
                            Response.Redirect("~/Admin/Admin_Landing_page.aspx");
                        }
                        else
                        {
                            Session["username"] = reader["Id"].ToString();
                            Response.Redirect("~/EndUser/myhome.aspx");
                        }
                    }
                    reader.Close();
                }

            }
            else
            {
                ltr_error.Text = (string)cmd.Parameters["@Error"].Value;                                        }
        }
    }
}
4

2 に答える 2

2

http://www.roorkichap.com/sliding-login-panel-built-with-jquery-asp-net-vb-net-and-sql-server-2000/ ソースコードをダウンロードしてチェックアウト

于 2012-11-12T11:43:18.957 に答える
1

更新されたバージョン: Literalはページ上にタグを生成しません。したがって、次のIDを設定する必要があります

Literalをラップするタグ。(またはあなたにより適したもの)

<p id="p_error" class="grey"><asp:Literal ID="ltr_error" runat="server"></asp:Literal></p>

その後、jsを使用してテキストをチェックできます。

$(document).ready(function() {
    if ($("#p_error").text() != "") //choose condition more suitable for you
        $("div#panel").slideDown("slow");
});
于 2012-04-11T13:06:44.980 に答える