Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Values won't change...please help 1

Status
Not open for further replies.

drwunz

Programmer
Dec 17, 2001
34
US
I have a data grid with edit and a 'New Incident' button.
If I click the button, a blank form is displayed which I can fill in and save the record. If I click Edit, the same form is displayed with the current data filled in...if I change any of the fields and click Save, the .Text properties still have the old value in them. What did I not do?
 
You are trying to access the wrong data. The cell(n).text field will not have changed, but the data in the textbox field will have changed (remember that when you go into edit mode, the cell text is merely hidden and replaced with a textbox).

For example, if the field you are updating is in the third cell, and you want the new text out of the textbox, do this:

Dim UpdatedText As String = CType(e.Item.Cells(2).Controls(0), Web.UI.WebControls.TextBox).Text

Breaking this down, we explicitly convert the first control--Controls(0)--in the third cell--Cells(2)--into a textbox webcontrol, and then get the text from this textbox and store it in a string.

Hope this makes sense. If not, I'll try to clarify!

Kevin B.
.Net Programmer [thumbsup]
 
I think I understand what you're saying, but perhaps I need to clarify. I'm selecting the row from the grid to edit, but the edit screen consists of TextBox and ComboBox controls with the data filled in from the record. When I make changes to the Text/ComboBoxes and submit that form, I don't get the changes. But, if I use the same form to fill in the boxes for a new record, it works fine.
 
Never mind...
I was populating the form from the DB each time...not just if 'not ispostback'. putting the call to populate the form inside the if statement cured it.

Thanks for your help...what you gave me about updating in the grid will be helpfull in another screen, and I didn't know about that either[2thumbsup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top