Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

In my datagrid , there is a column display the boolean data from database filed ( True/False) .

 

Instaed of True/False, I would like to format the boolean data to Yes/No or checkbox . How to implent this function ?

  • *Experts*
Posted

You can use the CheckBox column type or control. I'm not exactly sure how to set this up from here (don't have .NET installed on this machine), but I can help in the morning if you can't get it.

 

As far as displaying True/False, Yes/No, or anything custom, I've always done the conversion in my query (or stored proc for SQL Server). It seems easier, and using a UDF in SQL Server means changing the text is fairly easy.

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
  • 4 years later...
Posted

I have accomplished this within the select clause that populates the datagrid. Add something like this to your select clause:

SELECT cmsTotalScore,

CASE cmsEmSent

WHEN 1 THEN 'Yes'

WHEN 0 THEN 'No'

END AS Sent

FROM cmscores

 

Add Sent to the column required in the datagrid

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...