Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   Converting bit false to string No in Datagrid column (http://www.velocityreviews.com/forums/t773487-converting-bit-false-to-string-no-in-datagrid-column.html)

stuart 06-09-2004 01:26 PM

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

Ken Cox [Microsoft MVP] 06-10-2004 01:22 PM

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



Ken Cox [Microsoft MVP] 06-10-2004 03:59 PM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57