I have been trying to use a RadioButton in a Datalist, which works for a Checkbox. But the RadioButton doesn't allow only one button to be selected.
This works but when you change the CheckBox to RadioButton - it displays correctly but does not behave as a set of radiobuttons.
So I changed this to use a RadioButtonList and not the DataList:
But I get an error that says I can't use Eval with this so I change it to do the Binding in the Code Behind. But how do I do it so it will do the Checked based on the data recieved? As well as my Attribute (PermissionId)?
Thanks,
Tom
This works but when you change the CheckBox to RadioButton - it displays correctly but does not behave as a set of radiobuttons.
Code:
<asp:DataList ID="lstPermissions" runat="server" RepeatLayout="Flow">
<ItemTemplate>
<asp:CheckBox ID="rblPermission" TextAlign="right" runat="server" Text='<%# Eval( "PermissionName") %>'
PermissionId='<%# Eval( "PermissionId") %>' Checked='<%# Convert.ToBoolean(Eval( "Assigned")) %>' />
</ItemTemplate>
</asp:DataList>
So I changed this to use a RadioButtonList and not the DataList:
Code:
<asp:RadioButtonList ID="rblPermission" TextAlign="right"
runat="server" Text='<%# Eval( "PermissionName") %>'
PermissionId='<%# Eval( "PermissionId") %>'
Checked='<%# Convert.ToBoolean(Eval( "Assigned")) %>' />
But I get an error that says I can't use Eval with this so I change it to do the Binding in the Code Behind. But how do I do it so it will do the Checked based on the data recieved? As well as my Attribute (PermissionId)?
Thanks,
Tom