![]() |
Converting bit false to string No in Datagrid column
Hi there
I have a dataset bound to a datagrid and the dataset/datagrid has a column bound to a bit field in a sql server database The problem I'm having is the datagrid is displaying 'True' and 'False', where I want it to display 'Yes' and 'No'. How can I do this? If this is not possible, how do I bind this column to a list of checkbox controls within the datagrid Cheers |
Re: Converting bit false to string No in Datagrid column
Hi Stuart,
You might be able to change the text in the label like this: <asp:TemplateColumn HeaderText="Boolean Value"> <ItemTemplate> <asp:Label id="Label1" runat="server"><%# IIF(DataBinder.Eval(Container, "DataItem.Boolean"),"Yes","No") %></asp:Label> </ItemTemplate> </asp:TemplateColumn> Does this help? Ken Microsoft MVP [ASP.NET] "stuart" <anonymous@discussions.microsoft.com> wrote in message news:78309E45-CCC4-4945-B3FF-83C6F9DBF652@microsoft.com... > Hi there, > > I have a dataset bound to a datagrid and the dataset/datagrid has a column > bound to a bit field in a sql server database. > The problem I'm having is the datagrid is displaying 'True' and 'False', > where I want it to display 'Yes' and 'No'. How can I do this? > If this is not possible, how do I bind this column to a list of checkbox > controls within the datagrid? > > Cheers |
Re: Converting bit false to string No in Datagrid column
Glad to help!
"stuart" <stuart@discussions.microsoft.com> wrote in message news:916AC754-B811-4456-951B-8DF0FBE3CDF5@microsoft.com... > Hi Ken, > > You rock my world..... > > Both of the suggestions you gave me were spot on! > > Thanks > > "Ken Cox [Microsoft MVP]" wrote: > >> Hi Stuart, >> >> You might be able to change the text in the label like this: >> >> <asp:TemplateColumn HeaderText="Boolean Value"> >> <ItemTemplate> >> <asp:Label id="Label1" runat="server"><%# >> IIF(DataBinder.Eval(Container, "DataItem.Boolean"),"Yes","No") >> %></asp:Label> >> </ItemTemplate> >> </asp:TemplateColumn> >> >> Does this help? >> >> Ken >> Microsoft MVP [ASP.NET] >> |
| All times are GMT. The time now is 06:12 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.