Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2008

Tip: Looking for answers? Try searching our database.

binding format

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Keith G Hicks - 09 Feb 2008 17:58 GMT
I have a sql field called Status (which can be 1, 2, 3 or 4)

In a details view ItemTemplate I'd like the bound label to show "Open" for
1, "Closed" for 2, etc. I figure I can do this with the databinding string.

Bind("status", "<format stuff here>")

Not sure how to do that or if this is even the best way. What should I do?

Thanks,

Keith
Keith G Hicks - 10 Feb 2008 01:39 GMT
Well, I figured out I can do this:

IIF(Eval("Status")=1,"NOP", IIF(Eval("Status")=2, "Open",
IIF(Eval("Status")=3, "Win", IIF(Eval("Status")=4, "Closed", ""))))

Not sure if there's a better way but the above works. Open to suggestions
though.

Keith
lue - 10 Feb 2008 23:38 GMT
If you use VB.NET You can use "Choose"  where the "status" is a variable
from 1 to 4
CStr(Choose("Status", "NOP", "Open", "Win", "Closed"))

Regards

> Well, I figured out I can do this:
>
[quoted text clipped - 5 lines]
>
> Keith
Keith G Hicks - 12 Feb 2008 05:11 GMT
Cool function. Thanks. Didn't know about that. :-)

Keith

> If you use VB.NET You can use "Choose"  where the "status" is a variable
> from 1 to 4
[quoted text clipped - 11 lines]
> >
> > Keith

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.