i am using ASP.NET, C# and SQL SERVER2000
i have a page with one Textbox and a Button,
my question is i want to avoid the page load event when i click on the button , (i mean click event)
because i found that page load event is firing first before the button click event.
For me what i wanted to do is when i Click on the button i want to update somevalues to the database. For Ex.
i have two function
1. DisplayValue() // is for fetch the value from databse and display it to the Textbox.
2.UpdateValue() // is for fetch the value from Textboxe and insert/update into Database.
for Ex. my code look slike this
private void Page_Load(object sender, System.EventArgs e)
DisplayValue() // I must use this function because i want to display the value when page loads.
private void btnUpdate_Click(object sender, System.EventArgs e)
// it should take the present value in the Textbox and Update ( unfortunatly present value is changing with the datbase value cos of Page_load :-(
Here in my case i am changing the value in the Textbox and click the Update button, for update the value to the Database. BUT when i click Update button , the Page_Load fires and set the textbox value from the databse so it will get changed the value i Enterd in the page...! then only btnUpdate_Click event fires, so always it will get updat the exsiting value not the value i am entering in the Textbox..!
IF I DON'T USE the DisplayValue() function in the Page_Load , then it is UPDATING properly..! but then how do i DISPLY the present value in Database?