I'm having problems finding a control in my grid. I've been stuck on this for a couple of days and have searched the forums, following examples and links to documentation, with no luck. Here's a snippet from the aspx page.
And here's a snippet from code behind.
DropDownList list =item.FindControl("HeaderDropDown") as DropDownList; always returns null.
What am I not getting here?
Thanks,
<telerik:GridTemplateColumn UniqueName="ddHeader" HeaderText="Header"> |
<EditItemTemplate> |
<asp:DropDownList ID="HeaderDropDown" runat="server" /> |
</EditItemTemplate> |
</telerik:GridTemplateColumn> |
And here's a snippet from code behind.
private void Grid1_ItemDataBound(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridEditableItem) |
{ |
GridEditableItem item = e.Item as GridEditableItem; |
Dictionary<string, string> dict = new Dictionary<string, string>(); |
dict = ReadHeader(); |
DropDownList list =item.FindControl("HeaderDropDown") as DropDownList; |
list.DataSource = dict; |
list.DataBind(); |
} |
} |
DropDownList list =item.FindControl("HeaderDropDown") as DropDownList; always returns null.
What am I not getting here?
Thanks,