HighTechTalks DotNet Forums  

Formatting datagrid column to show boolean as Yes/no instead of truefalse

ASP.net Data Grid Control microsoft.public.dotnet.framework.aspnet.datagridcontrol


Discuss Formatting datagrid column to show boolean as Yes/no instead of truefalse in the ASP.net Data Grid Control forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
SStory
 
Posts: n/a

Default Formatting datagrid column to show boolean as Yes/no instead of truefalse - 05-11-2004 , 12:28 PM






Is there a way to change the formatting expression of a column in the
property builder of the datagrid to make boolean values appear as yes/no
instead of true/false?

thanks,

shane



Reply With Quote
  #2  
Old   
Scott Mitchell [MVP]
 
Posts: n/a

Default Re: Formatting datagrid column to show boolean as Yes/no insteadof truefalse - 05-11-2004 , 02:02 PM






Quote:
Is there a way to change the formatting expression of a column in the
property builder of the datagrid to make boolean values appear as yes/no
instead of true/false?
Not through the Property Builder, no. You should use a TemplateColumn
that calls a custom function that customizes the output. (Displays Yes
for True, No for False, or whatever...) See:
http://datawebcontrols.com/faqs/Cust...umnValue.shtml

--

Scott Mitchell
mitchell (AT) 4guysfromrolla (DOT) com
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!


Reply With Quote
  #3  
Old   
Eliyahu Goldin
 
Posts: n/a

Default Re: Formatting datagrid column to show boolean as Yes/no instead of truefalse - 05-12-2004 , 06:12 AM



You can use PreRender event to go through all items and replace true/false
with yes/no.

Eliyahu

"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote

Quote:
Is there a way to change the formatting expression of a column in the
property builder of the datagrid to make boolean values appear as yes/no
instead of true/false?

thanks,

shane





Reply With Quote
  #4  
Old   
SStory
 
Posts: n/a

Default Re: Formatting datagrid column to show boolean as Yes/no instead of truefalse - 05-12-2004 , 10:36 AM



could you show me a little code please?

Thanks for the reply,

Shane

"Eliyahu Goldin" <removemeegoldin (AT) monarchmed (DOT) com> wrote

Quote:
You can use PreRender event to go through all items and replace true/false
with yes/no.

Eliyahu

"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote in message
news:%23rXfIT3NEHA.3124 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is there a way to change the formatting expression of a column in the
property builder of the datagrid to make boolean values appear as yes/no
instead of true/false?

thanks,

shane







Reply With Quote
  #5  
Old   
Eliyahu Goldin
 
Posts: n/a

Default Re: Formatting datagrid column to show boolean as Yes/no instead of truefalse - 05-13-2004 , 04:36 AM



In this example the column # 3 contains boolean value you want to render as
"Yes/No"

private void myGrid_PreRender(object sender, System.EventArgs e)
{
// apply PreRender rules to every row
foreach (DataGridItem item in (sender as DataGrid).Items)
{
if (item.Cells[3].Text.ToUpper() == "TRUE")
item.Cells[3].Text = "Yes";
else
item.Cells[3].Text = "No";
}
}

Eliyahu
"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote

Quote:
could you show me a little code please?

Thanks for the reply,

Shane

"Eliyahu Goldin" <removemeegoldin (AT) monarchmed (DOT) com> wrote in message
news:%23AWuvEAOEHA.1456 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
You can use PreRender event to go through all items and replace
true/false
with yes/no.

Eliyahu

"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote in message
news:%23rXfIT3NEHA.3124 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is there a way to change the formatting expression of a column in the
property builder of the datagrid to make boolean values appear as
yes/no
instead of true/false?

thanks,

shane









Reply With Quote
  #6  
Old   
SStory
 
Posts: n/a

Default Re: Formatting datagrid column to show boolean as Yes/no instead of truefalse - 05-13-2004 , 09:23 AM



awesome solution! Works great.

thanks,

Shane

"Eliyahu Goldin" <removemeegoldin (AT) monarchmed (DOT) com> wrote

Quote:
In this example the column # 3 contains boolean value you want to render
as
"Yes/No"

private void myGrid_PreRender(object sender, System.EventArgs e)
{
// apply PreRender rules to every row
foreach (DataGridItem item in (sender as DataGrid).Items)
{
if (item.Cells[3].Text.ToUpper() == "TRUE")
item.Cells[3].Text = "Yes";
else
item.Cells[3].Text = "No";
}
}

Eliyahu
"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote in message
news:%23hYx44COEHA.3348 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
could you show me a little code please?

Thanks for the reply,

Shane

"Eliyahu Goldin" <removemeegoldin (AT) monarchmed (DOT) com> wrote in message
news:%23AWuvEAOEHA.1456 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
You can use PreRender event to go through all items and replace
true/false
with yes/no.

Eliyahu

"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote in
message
news:%23rXfIT3NEHA.3124 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is there a way to change the formatting expression of a column in
the
property builder of the datagrid to make boolean values appear as
yes/no
instead of true/false?

thanks,

shane











Reply With Quote
  #7  
Old   
Saravana [MVP]
 
Posts: n/a

Default Re: Formatting datagrid column to show boolean as Yes/no instead of truefalse - 05-14-2004 , 12:13 AM



You can try this method also . Check out "Manipulating DataSource Values
while binding to DataGrid" section in the following article.
http://www.microsoft.com/india/msdn/...rQuestions.asp
x


--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com



"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote

Quote:
awesome solution! Works great.

thanks,

Shane

"Eliyahu Goldin" <removemeegoldin (AT) monarchmed (DOT) com> wrote in message
news:eYJ6izLOEHA.3624 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
In this example the column # 3 contains boolean value you want to render
as
"Yes/No"

private void myGrid_PreRender(object sender, System.EventArgs e)
{
// apply PreRender rules to every row
foreach (DataGridItem item in (sender as
DataGrid).Items)
{
if (item.Cells[3].Text.ToUpper() == "TRUE")
item.Cells[3].Text = "Yes";
else
item.Cells[3].Text = "No";
}
}

Eliyahu
"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote in message
news:%23hYx44COEHA.3348 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
could you show me a little code please?

Thanks for the reply,

Shane

"Eliyahu Goldin" <removemeegoldin (AT) monarchmed (DOT) com> wrote in message
news:%23AWuvEAOEHA.1456 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
You can use PreRender event to go through all items and replace
true/false
with yes/no.

Eliyahu

"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote in
message
news:%23rXfIT3NEHA.3124 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is there a way to change the formatting expression of a column in
the
property builder of the datagrid to make boolean values appear as
yes/no
instead of true/false?

thanks,

shane













Reply With Quote
  #8  
Old   
SStory
 
Posts: n/a

Default Re: Formatting datagrid column to show boolean as Yes/no instead of truefalse - 06-25-2004 , 12:05 PM



Thanks.

I have found a lot of good information from the Microsoft India site.

"Saravana [MVP]" <saravank (AT) sct (DOT) co.in.nospam> wrote

Quote:
You can try this method also . Check out "Manipulating DataSource Values
while binding to DataGrid" section in the following article.

http://www.microsoft.com/india/msdn/...rQuestions.asp
x


--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com



"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote in message
news:O#Iox0OOEHA.2920 (AT) tk2msftngp13 (DOT) phx.gbl...
awesome solution! Works great.

thanks,

Shane

"Eliyahu Goldin" <removemeegoldin (AT) monarchmed (DOT) com> wrote in message
news:eYJ6izLOEHA.3624 (AT) TK2MSFTNGP10 (DOT) phx.gbl...
In this example the column # 3 contains boolean value you want to
render
as
"Yes/No"

private void myGrid_PreRender(object sender, System.EventArgs
e)
{
// apply PreRender rules to every row
foreach (DataGridItem item in (sender as
DataGrid).Items)
{
if (item.Cells[3].Text.ToUpper() == "TRUE")
item.Cells[3].Text = "Yes";
else
item.Cells[3].Text = "No";
}
}

Eliyahu
"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote in
message
news:%23hYx44COEHA.3348 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
could you show me a little code please?

Thanks for the reply,

Shane

"Eliyahu Goldin" <removemeegoldin (AT) monarchmed (DOT) com> wrote in message
news:%23AWuvEAOEHA.1456 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
You can use PreRender event to go through all items and replace
true/false
with yes/no.

Eliyahu

"SStory" <TheStorys (AT) TAKEOUTTHISSPAMBUSTERsofthome (DOT) net> wrote in
message
news:%23rXfIT3NEHA.3124 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Is there a way to change the formatting expression of a column
in
the
property builder of the datagrid to make boolean values appear
as
yes/no
instead of true/false?

thanks,

shane















Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.