Hi,
I have an update button click event like this :
lblmessage.text = txtAuthor.text;
Even though I manually change the data in text box, somehow it does not show on to the label field.Whatever value I put in txtAuthor the label field is empty.
Any help is greatly appreciated. I hope I have framed my question properly.
With the semi-colon after the line, it looks like C#, so, just in case - what language are you using (VB or C#)?
augustwind:
With the semi-colon after the line, it looks like C#, so, just in case - what language are you using (VB or C#)?
I am using C#. Actually the updated data from the textbox goes to the property of an object. But when I found there was a problem I created a label control to see if the data is being read from the text box. But no data is being read from the text box.
Well - I don't really know what to tell you - it definitely should work.
Save it again - and rebuild - then run it, and put a break point at the code line and see if it ever hits that line.
Are u changing the value of the textbox in the page load, because that event is fired first.
Hope this helps
Thanks
Vikram
Vikram's Blog
Are you using Visual Web Developer? I have the same problem sometime when trying to get the values for update/.
Thanks
e_screw:
Are you using Visual Web Developer? I have the same problem sometime when trying to get the values for update/.
Thanks
I am using the Full blown edition of VS. I guess as Vikram suggested I am gonna have to check the code in the page load event.
Thanks a lot for the reply guys. I was able to fix the problem.
The problem was that I was pulling the data from the database in the page load event. And whenever I click the update button the original data from teh DB get loaded due to the page load event firing first. So there was no update taking place. Hence the label control which was pulling the data from the textbox was pulling the original data instead of the updated data... I hope I make sense in what I said.
I fixed it by adding the code for pulling data from the DB inside the " if (! IsPostBack) { } " block within the page load event. That fixed the problem in the test page that I created. I havent yet tested it on other pages that I am having trouble with. Hope fully I have resolved the problem. Thanks to Vikram for pointing out the Page Load event.
0 comments:
Post a Comment