On the other hand, if you use <asp:CheckBox inside <ItemTemplate> </ItemTemplate> and if you store the values of true/false or 1/0 as field of type bit in your database, then you can do that as follows:
- <ItemTemplate>
- <asp:CheckBox ID="chk" runat="server" Checked='<%#DataBinder.Eval(Container.DataItem, "itemType") %>' />
- </ItemTemplate>
I'm using the Telerik GridTableView and have the following html:
<code>
<tr>
<td>
Item Type
</td>
<td>
<asp:RadioButtonList ID="rblItemType" RepeatDirection="Horizontal" runat="server" >
<asp:ListItem runat="server" Text="Visible System Wide" Value="1" />
<asp:ListItem runat="server" Text="Invisible System Wide" Value="0" />
</asp:RadioButtonList>
</td>
</tr>
</code>
I would like to set the selectedvalue thru the html as you described above, but didn't work for me. No intellisense was available for the Checked item.
If it didn't work thru the html, I wanted to do it thru the code-behind. Here is the following, but can't seem to get it right.
<code>
RadioButtonList itmtype = e.Item.FindControl("rblItemType") as RadioButtonList; // this has 2 items in the list - 1 & 0
itmtype.SelectedValue = itmtype.Items.FindByValue("the value coming back from the database").ToString();
</code>
I don't know what should be placed in the unbold faced itme above inside the findbyvalue.
I really need some help on this one.....