Board index » Web Programming » DataRepeater FindControl("controlX") ControlX was added to placeho
|
alanchinese
|
|
alanchinese
|
DataRepeater FindControl("controlX") ControlX was added to placeho
Web Programming88
Hello, I have a repeater control with a placeholder inside ItemTemplate. myRpt_ItemDataBound() event adds dropdown conrol (drpCntlr.ID = ControlX) to a place holder. Then on postback, I want to read this value selected by a user: drpX = (DropDownList)rptSelect.Items[i].FindControl("ControlX"); but drpX is null. How can I get the value of a control which was added dynamically to a placeholder? Thank you - |
| Teemu
Registered User |
Tue Feb 14 14:34:03 CST 2006
Re:DataRepeater FindControl("controlX") ControlX was added to placeho
Hi,
you'd need to add it in ItemCreated so that control instance exists also on postback. In ItemdataBound you'd just deal with the data-binding specific stuff, not control creation (if you need to check from data which type of control to create, you can do that in ItemCreated when e.Item.DataItem is not null, that is true when ItemCreated runs just before ItemdataBound e.g on DataBind() call) -- Teemu Keiski ASP.NET MVP, AspInsider Finland, EU blogs.aspadvice.com/joteke">blogs.aspadvice.com/joteke "WebMatrix" <WebMatrix@discussions.microsoft.com>wrote in message QuoteHello, - |
