hi experts...
my scenario is when user enter its right answer then it goes to next page otherwise shows an error "incorrect error"
- <table>
- <tr>
- <td>Security Question1</td>
- <td>
- <asp:DropDownList ID="ddlQuestion" runat="server" AppendDataBoundItems="true">
- </asp:DropDownList>
- <asp:TextBox ID="TxtAnswer" runat="server"></asp:TextBox>
- </td>
- </tr>
- <tr>
- <td>
- <asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" />
- </td>
- </tr>
- <tr>
- <td>
- <asp:Label ID="lblerror" runat="server"></asp:Label>
- </td>
- </tr>
- </table>
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- using (var context = new schoolEntities6())
- {
- string username = Request.QueryString["username"];
- var user = (from c in context.SecurityQuestions
- where c.SecQue == ddlQuestion.SelectedItem.Value
- select c).FirstOrDefault();
- if (user != null)
- {
- schoolEntities6 db = new schoolEntities6();
- Session["UserName"] = username;
- Response.Redirect("/ChangePassword.aspx?username=" + username);
- }
- else
- {
- lblerror.Text = "incorrect answer";
- }
- }
- }
I am using this way to execute but doesn't work...