[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

unable do find dynamically created controls in a datalist

=?Utf-8?B?cm9kY2hhcg==?=

2/25/2004 10:11:00 PM

Hi
I am using a datalist control to display data from the database like everyone else. However I am unable to find dynamically created controls in the datalist.

Description
To simplify the use case, for every record I retrieve from the database, I display a checkbox, a hidden field containing the id of the current record, and a description of the record (Literal text). At the end of the datalist, I have a button that when clicked will call a server method that will loop thru the datalist and depending on the checkbox state, it does the appropriate database processing
When I physically design the UI in the ItemTemplate, everything works fine. I am able to loop thru the datalist items collection and within each datalistitem, I am able to do a FindControl and find the checkbox and hidden field

Problem
When I don't use the itemTemplate, but instead dynamically draw the checkbox, hidden button, and description in the datalist's ondatabind event, the method I call when I click the button is unable to find the checkbox nor the hidden button. The datalist draws fine. The result seems to be identical to the result I get when I physically design the UI. Everything works fine except for the method not being able to find the controls

did I miss something

Thanks

jun