3 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 24 Dec 2008, 05:02 AM
Hi,
I hope you are trying to add a CheckBox to GridTemplateColumn in code behind. If so you can try the following code snippet.
ASPX:
CS:
Shinu
I hope you are trying to add a CheckBox to GridTemplateColumn in code behind. If so you can try the following code snippet.
ASPX:
<telerik:GridTemplateColumn HeaderText="TempCol" UniqueName="TempCol" > |
</telerik:GridTemplateColumn> |
CS:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) |
{ |
if (e.Item is GridDataItem) |
{ |
GridDataItem item = (GridDataItem)e.Item; |
CheckBox chkbx = new CheckBox(); |
chkbx.ID = "CheckBox1"; |
item["TempCol"].Controls.Add(chkbx); |
} |
} |
Shinu
0

Sals
Top achievements
Rank 1
answered on 30 Dec 2008, 04:58 PM
Hi Sinu:
Here is the ASPX code that I need to use in my custom server control using RadGrid. Can you please give me an idea or a way that how can I put all these in to code behind in a server control.
<asp:GridView>
Here is the ASPX code that I need to use in my custom server control using RadGrid. Can you please give me an idea or a way that how can I put all these in to code behind in a server control.
<asp:GridView>
<Columns>
<asp:TemplateField HeaderText="My Grid Test">
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkBox" OnCheckedChanged="chkBoxCheckChanged" Checked = '<%# Eval("value") %>'
AutoPostBack="True" Enabled="false"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="TestField1" HeaderText="Test 1" />
<asp:BoundField DataField="TestField2" HeaderText="Test 2" />
</Columns>
</asp:GridView>
</asp:GridView>
Thank you
-Sal
0

Princy
Top achievements
Rank 2
answered on 31 Dec 2008, 04:38 AM
Hello,
You can go through the following help link to understand how to create TemplateColumns programmatically. Refer to the section - 'Creating template columns programmatically' in the help document.
Programmatic creation
Princy.
You can go through the following help link to understand how to create TemplateColumns programmatically. Refer to the section - 'Creating template columns programmatically' in the help document.
Programmatic creation
Thanks
Princy.