Saturday, 17 August 2013

Using asp.net ajax method to stop the page from refreshing after a buttonclick in VS2012

Using asp.net ajax method to stop the page from refreshing after a
buttonclick in VS2012

Using VS2012, I have a button that gets clicked to return some info to a
textbox on the screen. I also have a label, label3, that is set to the
following
protected void Page_Load(object sender, EventArgs e)
{
Label3.Text = ("THE FIRST RUN RECORDED AT" +
DateTime.Now.ToString(" hh:mm:ss tt"));
}
Now naturally every time I press the button to return my information in
the other part of the c#/web form it refreshes the hh:mm:ss to the current
time.
My question is - Where I can call my function to stop my label from
refreshing when the button is clicked?
The button calls this
protected void Button1_Click(object sender, EventArgs e)
{
WebService1 ws1 = new WebService1();
Label2.Text = ws1.codes(TextBox1.Text);
}
It just returns a string dependent on input.

No comments:

Post a Comment