Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > FindControl Method no longer working...

Reply
Thread Tools

FindControl Method no longer working...

 
 
Karen
Guest
Posts: n/a
 
      05-11-2004
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


 
Reply With Quote
 
 
 
 
Scott Mitchell [MVP]
Guest
Posts: n/a
 
      05-11-2004
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
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
Reply With Quote
 
 
 
 
Karen
Guest
Posts: n/a
 
      05-11-2004
Thanks Scott,

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

Karen

On Tue, 11 May 2004 18:05:03 GMT, "Scott Mitchell [MVP]"
<(E-Mail Removed)> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FindControl() method and NamingContainer Dan ASP .Net 1 04-04-2007 08:42 PM
FindControl Method always returns empty string!!!!! steroche ASP .Net Building Controls 2 08-25-2005 03:15 AM
Help with FindControl method =?Utf-8?B?Sm9l?= ASP .Net 10 12-21-2004 11:13 PM
Programs taking longer and longer to start up. Help please. Goforit Computer Information 9 07-25-2004 06:34 AM
FindControl method doesn't work ani ASP .Net 0 11-05-2003 03:47 PM



Advertisments