FindControl Method no longer working...

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
 
S

Scott Mitchell [MVP]

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top