umair mohsin

umair mohsin

  • 1.3k
  • 387
  • 64.7k

page refresh question

Jul 22 2015 4:07 AM
here is my coding
 
HTML
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="name"></asp:Label>:<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
<br />


<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click1"/>
</div>
</form>
</body>
 
codebehind
 
protected void Page_Load(object sender, EventArgs e)
{




}


protected void Button1_Click1(object sender, EventArgs e)
{
if (Page.IsPostBack && TextBox1.Text == "")
{
Response.Write("<h3 style='color:red;'>please fill textbox</h3>");
}
else if(Page.IsPostBack)
{
TextBox1.Text = "";

}
if (Page.IsPostBack)
{
Response.Write("data sened to server is "+TextBox1.Text);
}

}
 
i want that if i refresh the page by pressing F5 all data in the textbox and  the  server side message should disappear.how could i do that
 

Answers (1)