How to add radio buttons into datagrid

G

Guest

Hi

User TemplateColumn which contains CheckBox:
<asp:TemplateColumn>
<ItemTemplate>
<asp:CheckBox ID="Checkbox1" Runat="server" Checked='<%#
DataBinder.Eval(Container.DataItem, "[BOOL_VALUE_FIELD]") %>'
Enabled="False"/>
</ItemTemplate>
<EditItemTemplate>
<asp:CheckBox ID="chkMaksettu" Runat="server" Checked='<%#
DataBinder.Eval(Container.DataItem, "[BOOL_VALUE_FIELD]") %>'/>
</EditItemTemplate>

Instead of using DataBinder.Eval function to control CheckBox status, you
can do it in DataGrids OnItemDataBound event:
((CheckBox)e.Item.FindControl("CheckBox")).Checked = [true|false]

Hope this helps
-Joopa-
</asp:TemplateColumn>
 
G

Guest

Hello again

Maybe I also should read questions bit more carefully, you were asking about
radiobuttons NOT CHECKBOXES :-|
Sorry about that, my mistake.

-Joopa-
 
G

Guest

Use template coloumns:

<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:RadioButton id="rb" Text='Caption' runat="server"/>
<ItemTemplate>
<TemplateColumn>
<Columns>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top