PC Review


Reply
Thread Tools Rate Thread

Displaying a null decimal value as a string

 
 
Microsoft News Group
Guest
Posts: n/a
 
      30th Aug 2006
I am trying to make a column which is decimal format, convert nulls to a
certain string such as "No Max".
This is for a price range, and if they do not put a value in, a null value
is put in place, but displays "No Max", but if it is not null, then it would
display the decimal value in place. How can I do this in the gridview.


 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGFiYmxlcg==?=
Guest
Posts: n/a
 
      30th Aug 2006
Not quite sure but a suggestion:

Are you talking about nulll in SQL column? In this case the SQLType.DBNull
is converted to 0 in a bound field. If you convert the bound field to a
template field you might be able to use a Label or TextBox control and
convert the 0 value in the OnPreRender event. This would presumably would
have ReadOnly set to true.

You might also be able to do something like:

<%#Eval("PriceRange")==DBNull.Value?"NoMax":Eval("PriceRange")%>

although I'm not sure about using the Eval on the right side of the
conditional expression.

I think most developers would encourage you to use ObjectDataSource and do
the retrieval and conversion in the business object

"Microsoft News Group" wrote:

> I am trying to make a column which is decimal format, convert nulls to a
> certain string such as "No Max".
> This is for a price range, and if they do not put a value in, a null value
> is put in place, but displays "No Max", but if it is not null, then it would
> display the decimal value in place. How can I do this in the gridview.
>
>
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
How to tell if a string element is null or really null? Jiho Han Microsoft ASP .NET 13 29th Jul 2006 02:45 AM
Displaying a decimal with 2 decimal places (ie currency!) Scott Microsoft VB .NET 2 6th Mar 2005 04:32 PM
C# - C sharp - String to decimal, decimal point disappears! BA Microsoft Dot NET 7 2nd Mar 2005 08:43 AM
C# - C sharp - String to decimal, decimal point disappears! BA Microsoft C# .NET 7 2nd Mar 2005 08:43 AM
validating a null string and an empty string in same IF statement? VMI Microsoft C# .NET 5 13th Oct 2004 10:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:49 PM.