narasiman rao

narasiman rao

  • NA
  • 519
  • 485.2k

In Back arrow (Click to go back) how to set label false.

Sep 5 2016 10:28 AM
 My run mode as follows

 
Detailspage as follows

Empid    10001

Mobile    9784000002

  Submit (Button)

When i give the correct Empid and Mobile it redirects to Registration page in a new tab window.

In that New tab window in browser when i press back (<Wink | ;-) arrow it will go detailspage.aspx.

Then again when i enter wrong Empid and Mobile it shows the message in the label1 as "Your Data does not match".


Then user enter the correct Empid and Mobile it redirects to Registration page in a new tab window.

In that New tab window, in browser when i press back (<Wink | ;-) arrow it will go Detailspage.aspx. in that detailspage.aspx previously shows the message in the label1
"Your Data does not match". that message to set visible false.




In submit button code as follows


protected void btnsubmit_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString="Data Source=.\\SQLEXPRESS;Initial Catalog=test;Integrated Security=True;"
string query = "select * from login where Empid= '" + txtempid.text + "' and mobile = '" + txtmobile.text + "'";
SqlCommand cmd = new SqlCommand(query,con);
con.open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
Datatable dt = new datatable();
da.Fill(dt);
if(dt.Rows.Count > 0)
{

Response.Redirect("Detailspage.aspx");
label.visible = false;
}

else
{
label1.text = "Your Data does not match";
}

}


But when i run the code the label1 is not visible false. when it redirects to Details.aspx page.

Please help me what is the mistake in my above code.
 

Answers (2)