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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox in datagrid

Status
Not open for further replies.

redheadpgr

Programmer
Feb 8, 2002
17
0
0
US
I have a column in a datagrid that is a template column. When the user clicks EDIT on the row, the user can then edit data in the textbox in that row.

When they click UPDATE, the program executes the following code:
Code:
Dim txtTextBox as TextBox
Dim strText as String

txtTextBox = e.Item.FindControl("txtSomeTextBox")
strText = Trim(txtTextBox.Text)
The trouble is that when this code executes, the txtTextBox.Text is holding only the original text and not the edited text. Any clues?

I'm sure this is something simple.

Thanks in advance for your help.
 
Found out the problem.

In the Page Load event, which is where the data is binded to the grid control initially, I did not check for IsPostBack. What I should have had in the Page Load was something like:

Code:
If Not IsPostBack Then
...
    dgGrid.DataSource = dtTable
    dgGrid.DataBind
...
End If

Happy Computing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top