This is a migrated thread and some comments may be shown as answers.

[Solved] reference template column control

2 Answers 163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Knut
Top achievements
Rank 1
Knut asked on 17 Nov 2009, 05:40 PM

Hello,

I can't figure out how to reference a RadioButtonList in a RadGrid GRidtemplate column header template:

 

<Columns>  
<telerik:GridTemplateColumn DataField="cd_nr" HeaderText="cdNr" UniqueName="cdNr"
  
<HeaderTemplate>  
<asp:RadioButtonList ID="rbtnLst_cdNo" runat="server" RepeatDirection="Vertical"
  
<asp:ListItem Text="1" Value="1"></asp:ListItem>  
</asp:RadioButtonList> 
  
</HeaderTemplate> 

 

 

In codebehind, I have:
RadioButtonList selCd = rGrd_trckList.MasterTableView.FindControl("rbtnLst_cdNo") as RadioButtonList;

but that's just null.

What am I missing?
knut

 

 

 

 

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 18 Nov 2009, 04:33 AM
Hi Knut,

Try the following code snippet in order to access the control placed in HeaderTemplate of Radgrid.

CS:
 
    protected void Button1_Click(object sender, EventArgs e) 
    { 
        GridHeaderItem headerItem = (GridHeaderItem)RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0]; 
        RadioButtonList buttonList = (RadioButtonList)headerItem.FindControl("rbtnLst_cdNo"); 
    } 

Regards,
Shinu.
0
Knut
Top achievements
Rank 1
answered on 18 Nov 2009, 04:52 AM
Shinu,

That's it - thank you very much!

knut
Tags
Grid
Asked by
Knut
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Knut
Top achievements
Rank 1
Share this question
or