FindControl Method no longer working...

  • Thread starter Thread starter Karen
  • Start date Start date
K

Karen

Hi,

We have a datagrid with a templated column. This column contains a
textbox. Up until yestday this code (below) worked fine.

str_note =
CType(DetailsGrid.Items(mintRowsLoop).FindControl("txtNote"),
TextBox).Text()

If mintRowsLoop = 0 (first row in datagrid) the above code doesn't
return the text that was entered.

I've rebuilt the column an still doesn't work.

The debugger shows the text property of = ""....argh...

Any suggestions or ideas?

Thanks,
Karen
 
Karen said:
We have a datagrid with a templated column. This column contains a
textbox. Up until yestday this code (below) worked fine.

str_note =
CType(DetailsGrid.Items(mintRowsLoop).FindControl("txtNote"),
TextBox).Text()

If mintRowsLoop = 0 (first row in datagrid) the above code doesn't
return the text that was entered.

Karen, FindControl is working, I assure you, otherwise you'd get an
error when trying to reference the Text property.

Are you sure you are not binding the DataGrid on EVERY page load, but
only on the FIST page load? Assuming you are reading the value after,
say, the Update button was clicked, it is common to have the values
"reset" if you are blindly rebinding on each page load. For more info, see:
http://datawebcontrols.com/faqs/Editing/EditedValuesNotSaved.shtml

--

Scott Mitchell
(e-mail address removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
Back
Top