Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Converting bit false to string No in Datagrid column

Reply
Thread Tools

Converting bit false to string No in Datagrid column

 
 
stuart
Guest
Posts: n/a
 
      06-09-2004
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
 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      06-10-2004
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      06-10-2004
Glad to help!

"stuart" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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]
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the point of having 16 bit colour if a computer monitor can only display 8 bit colour? How do you edit 16 bit colour when you can only see 8 bit? Scotius Digital Photography 6 07-13-2010 03:33 AM
False positive, false intrusion, false alarm Nick Computer Security 3 04-26-2006 07:40 PM
bind a dropdown in a column in a datagrid based on the dropdown value selected in another column of the datagrid. vishnu ASP .Net 1 03-25-2006 01:24 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit, Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new ! vvcd Computer Support 0 09-17-2004 08:15 PM
64 bit - Windows Liberty 64bit, Windows Limited Edition 64 Bit,Microsoft SQL Server 2000 Developer Edition 64 Bit, IBM DB2 64 bit - new! Ionizer Computer Support 1 01-01-2004 07:27 PM



Advertisments