By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,649 Members | 2,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,649 IT Pros & Developers. It's quick & easy.

FindControl Method no longer working...

P: n/a
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
Nov 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Karen wrote:
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/Edit...NotSaved.shtml

--

Scott Mitchell
mi******@4guysfromrolla.com
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
Nov 18 '05 #2

P: n/a
Thanks Scott,

Appears someone alterd the page load event yesterday...lol.

Karen

On Tue, 11 May 2004 18:05:03 GMT, "Scott Mitchell [MVP]"
<mi******@4guysfromrolla.com> wrote:
Karen wrote:
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/Edit...NotSaved.shtml


Nov 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.