Currently my Grid shows True, False, or N/A in the cell for boolean values. What would be the way so that I can get it to show Yes, No, or blank? The users are somehow getting confused by True/False/NA.
I'm populating the Grid using a SQLDataSource tied to a stored procedure in a 2005 SQLServer database. Also, I am using a RowEditTemplate where the value is tied to a radiobutton group.
Thanks,
Will
Hello Will,
You can add a Template Field to WebDataGrid.Columns collection and put RadioButton in it.
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="400px"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
<Columns>
<ig:BoundDataField DataFieldName="id" Key="id">
<Header Text="id" />
</ig:BoundDataField>
<ig:TemplateDataField Key="TemplateField_0">
<ItemTemplate>
<asp:RadioButton ID="RadioButton1" runat="server" Text='<%# GetBool(Eval("IsChecked").ToString())%>' Checked='<%# Eval("IsChecked").ToString() == "True" ? true : false %>'/>
</ItemTemplate>
<Header Text="TemplateField_0" />
</ig:TemplateDataField>
</Columns>
</ig:WebDataGrid>
Also you have to add a method in code behind, which returns string value if the field is true, false or null:
protected string GetValue(string value)
{
if (value == "True")
return "Yes";
}
else
if (value == "False")
return "No";
return "Not Set";
Please let me know if you have any further questions with this matter.
Thank you
Sincerely,
Hristo Valyavicharski
Developer Support Engineer
Infragistics, Inc.
www.infragistcis.com/support
Thanks for the code!
Where are we using the GetValue method though? Maybe I'm missing something.