I want to display login form on a collapsible panel extender for login a user. Please help me for this Ajax problem.
I got the answer but. It is working only with IE. It is not working with Firefox. Your comments are honored.
//add first script manager
Then.....
<div class="secpanel">
<table id="login">
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr>
<td>User name:</td>
<td>
<asp:TextBox ID="usrtxt" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>Password:</td>
<td>
<asp:TextBox ID="passtxt" TextMode="Password" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="loginbtn" runat="server" Text="Login" ValidationGroup="g1"
onclick="loginbtn_Click"/></td>
</tr>
<tr>
<td colspan="2">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="Please enter user name" ControlToValidate="usrtxt"
ForeColor="Red" ValidationGroup="g1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage="Please enter password" ControlToValidate="passtxt"
ForeColor="Red" ValidationGroup="g1"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Label ID="err" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
</table>
</div>
</asp:Panel>
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" TargetControlID="secpanel" CollapseControlID="fstpanel" ExpandDirection="Vertical" TextLabelID="lbl" CollapsedText="Click to login" ExpandedText="Hide" CollapsedSize="0" ExpandedSize="200" ExpandControlID="fstpanel" Collapsed="true" ScrollContents="false" runat="server">
</asp:CollapsiblePanelExtender>
//code for the submit button
SqlConnection con = new SqlConnection();
con.ConnectionString = ConfigurationManager.ConnectionStrings["hw"].ConnectionString.ToString();
con.Open();
SqlCommand cmd = new SqlCommand("select * from Login where Admin_name=@", con);
//cmd.Parameters.Add("@user", usrtxt.Text);
//cmd.Parameters.AddWithValue("@user", usrtxt.Text);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if((usrtxt.Text==dr.GetString(1)) && (passtxt.Text==dr.GetString(2)))
{
Session["admin"]=dr.GetString(1);
Response.Redirect("Admin.aspx");
}
else
{
err.Text="You are not autorized";
}
cmd.Dispose();
}
con.Close();