|
|
 |
| ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other programmers’ questions, win occasional prizes given to our best members, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
|
 |
|
|
 |

April 28th, 2007, 02:10 AM
|
|
Authorized User
|
|
Join Date: Apr 2007
Location: delhi, delhi, India.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How to show text in datalist while value in NULL
hello guys,
pls solve my problem
my problem is that
i m retreive data from table but in some column the value is store NULL. i want that insist of NULL it wl display some text in datalist while data retreive from databse
Eg.
employee //table name
Date //column name
14/6/82
NULL
15/6/82
i want display it in this format
employee //table name
Date //column name
14/6/82
Date Not Filled
15/6/82
is it possible if yes then send me solution of this problem with the help of example.
thanks
|

April 30th, 2007, 03:04 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Location: , , India.
Posts: 547
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Depends how you are filling your datalist, one way could be checking for null from database itself using the ISNULL function, another way could be checking for null while binding, something like below:
<asp:Label Runat="server" ID="lblTest" text='<%#DataBinder.Eval(Container.DataItem,"no")= = DBNull.Value.ToString() ? "Date not filled" : DataBinder.Eval(Container.DataItem,"no")%>'>
There could be lot other ways too....
Regards
Mike
Fortune favours the brave, so don't regret on missed oppurtunities.
|

May 1st, 2007, 01:59 AM
|
|
Authorized User
|
|
Join Date: Apr 2007
Location: delhi, delhi, India.
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
helo sir,
this is not working
it is giving error:
BC30201: Expression expected
i m using ur solution in datalist like this:
<%# DataBinder.Eval(Container.DataItem,"promotiondue") == DBNull.Value.ToString() ? "Date not filled" : DataBinder.Eval(Container.DataItem,"promotiondue") %>
but they r not executing
can u send the sloution
Quote:
quote:Originally posted by mike_remember
Depends how you are filling your datalist, one way could be checking for null from database itself using the ISNULL function, another way could be checking for null while binding, something like below:
<asp:Label Runat="server" ID="lblTest" text='<%#DataBinder.Eval(Container.DataItem,"no")= = DBNull.Value.ToString() ? "Date not filled" : DataBinder.Eval(Container.DataItem,"no")%>'>
There could be lot other ways too....
Regards
Mike
Fortune favours the brave, so don't regret on missed oppurtunities.
|
|

May 1st, 2007, 07:36 AM
|
|
Wrox Author
Points: 13,101, Level: 49 |
|
|
Join Date: Oct 2005
Location: Akron, Ohio, USA.
Posts: 4,079
Thanks: 1
Thanked 52 Times in 52 Posts
|
|
Personally, I do this in my SQL statements so I do not have to deal with NULL values in code.
SELECT ISNULL([column], 'No Data') as [column] FROM [table]
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
|

September 1st, 2007, 07:28 PM
|
|
Registered User
|
|
Join Date: Sep 2007
Location: Detroit, MI, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hey dparsons: great, great great aproach... you've just solved my misery... ;)
==============================================
...no such things as a day at the beach..
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |