Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using findcontrol in a user control
Message
From
23/02/2011 07:07:22
 
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01501388
Message ID:
01501396
Views:
30
>>HI
>>
>>I've got a page that contains a user control which load some telerik comboboxes.
>>
>>In the page load I'm trying to set some checkbox values on the combo controls but when I try to get the items in the control it returns 0
>>
>>any ideas what I'm doing wrong.
>>
>>Thanks
>>
>>(the code is below)
>>
>>
>> Dim radModels As Telerik.Web.UI.RadComboBox = DirectCast(Me.DateRangeSelector1.FindControl("radModels"), Telerik.Web.UI.RadComboBox)
>>                For Each item As Telerik.Web.UI.RadComboBoxItem In radModels.Items
>>                    Dim chk As CheckBox = DirectCast(item.FindControl("chk1"), CheckBox)
>>                    If item.Text <> ModelName Then
>>                        chk.Checked = False
>>                    Else
>>                        chk.Checked = True
>>                    End If
>>                Next
>>
>I don't have the Telerik stuff and I see the RadComboBoxItem overrides the native WebControl.FindControl() method (http://www.telerik.com/help/aspnet/combobox/radcombobox-telerik.webcontrols.radcomboboxitem-findcontrol.html) without descibing how the behaviour is changed. Anyway it's not clear to me where you're problem really lies.
>Are there no items in the radModels collection?
>If there are does .FindControl("chk1") return anything before the cast?

Hi Viv

radModels has an item count of 0 so I assume I'm not getting it correctly.

Nick
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform