473,770 Members | 1,644 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Displaying a null decimal value as a string

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.
Aug 30 '06 #1
1 2068
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("PriceR ange")==DBNull. Value?"NoMax":E val("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 ObjectDataSourc e 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.
Aug 30 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
13536
by: Lynn | last post by:
Hi all, I am having problem when did the validation of XML document with Schema. my schema is like the following: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="schema.xsd" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" elementFormDefault="qualified" targetNamespace="schema.xsd"> <xsd:element name="bookstore" type="bookstoreType" /> <xsd:complexType name="bookstoreType"> <xsd:sequence maxOccurs="unbounded">...
6
6525
by: Markus Eßmayr | last post by:
Hello, I'd like to consume a WebService, which returns an array of objects which include several members of type System.String, System.Decimal and System.DateTime. In the WSDL-file, the members of the object are marked as nilable. I generated the client classes using VS.NET 2003. After the creation, I got the class-definition of the objects returned by the WebService too. BUT, only the System.String members where marked to be nullable,...
3
14387
by: Gustaf Liljegren | last post by:
I searched for previous answers on this, but couldn't find something fitting. I need advice on how to store decimal numbers with possible null values in memory. The numbers may be negative, so storing null values as -1 doesn't work. The numbers are amounts of money, so decimal is the best datatype, except that it can't store null values. The best idea so far is to make an object of each number and have it store either a decimal or null....
1
1996
by: .Net Sports | last post by:
the below itemdatabound function works , displays all the grand totals in the footer control of the datagrid: private void dglvboard_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) { DataRowView rowData; decimal price; decimal priceWk; decimal newssum;
17
4534
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are selected into 2 different SP variables and compared for equal. They are both NULL, but do not compare as equal. When the Not NULL columns (SALARY) are compared, they do compare as equal.
2
4292
by: rn5a | last post by:
How do I pass a NULL value to a field while inserting records in a SQL Server 2005 DB table using a stored procedure? I tried the following but it inserts an empty string & not a NULL value: ALTER PROCEDURE dbo.Purchase @UserID int, @Total decimal, @Address varchar(250) = NULL, @Country varchar(50) = NULL AS
1
5164
by: bunty.gopal | last post by:
This is the solution to the issue in the subject, question itself was posted in a previous thread long back. Use the latest DB2 db2cc.jar fixpack on the client, or add "deferPrepares=false" to the connection string when opening the connection (or connection pool properties, if deployed on a server like weblogic). The issue can be resolved using either of these options. Gopal
27
3129
by: Terry | last post by:
I am getting the following warning for the below function. I understand what it means but how do I handle a null reference? Then how do I pass the resulting value? Regards Warning 1 Function 'Dec2hms' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
6
21806
by: Bob | last post by:
Hello folks. I use this formating but if the value in dr is a null it generates an error "Object cannot be cast from DBNull to other types." Anybody know how I can deal with nulls? Thanks,
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7420
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5454
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3578
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2822
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.