-
txtbox not updating
On the page load I use a datareader to populate the textboxes on my page. I let the user make changes then on a save click event I run an update. The value stays the same in the txtbox, even though I made changes to it. I debug thru and the value is indeed the same. Has anyone come across this problem?
-
Even though you are running an update command to update the boxes, did you then re-read the data and re-populate the boxes?
And does the database show your new values in it?
-
if I comment out the datareader field and keep the txtbox empty, I can update it with different data. But , if I get the data from the data reader, then make an update, the same data that was placed into the txtbox is then updated to the database. The new value that I put in is not being stored in the txtbox.
what do you mean by re-reading the data. You mean I have to run the datareader again during the click event, where I will be updating?
-
Your description of what is going on is eluding me.
I think I need code.
As for the updated data. Yes, you have to re-create the reader and re-bind the data (at least from my experience) because the datareader once populated becomes static.
-
this is how I fill my textboxs on the page_load
Code:
Do While objDataReader.Read = True
txtBidId.Text = objDataReader("Bid_ID")
txtBuyerName.Text = objDataReader("Buyer_Name")
txtIntDisStartDate.Text = objDataReader("display_start_date")
txtBidOpenDate.Text = objDataReader("bid_date")
txtBidDesc.Text = objDataReader("bid_schedule_desc")
txtIntDisEndDate.Text = objDataReader("display_end_date")
then the user makes any changes they need and then on the save click event I have my update.
Code:
sqlCmd = "update pbss.pbss_bid_schedule "
sqlCmd = sqlCmd & "set bid_date= to_date('" & txtBidOpenDate.Text & "','MM/DD/YYYY')"
sqlCmd = sqlCmd & ",bid_status_code='" & Bid_Status & "'"
sqlCmd = sqlCmd & ",pre_bid_ind=0,bid_schedule_desc='" & txtBidDesc.Text & "'"
the problem I'm having is the textbox values are still holding the same values from when the datareader filled them up, even after changes have been made. I can see this when I debug
-
ok, now I see that when I click the save button my page is reloading and is going back to the page_load event, this is where I have my datareader to fill the page, then it goes to the click event, where my update is. I used a If Not me.IsPostBack to check if it's being posted back. Now I have to click twice to do a update.
How come the click event goes to the page load and then click event. Is there a way to stop it from reloading?