?
Solved

asp.net inline nested ternary

Posted on 2012-08-29
1
Medium Priority
?
962 Views
Last Modified: 2012-08-30
Hi everybody,

is it possible to nest a ternary inside an inline asp.net command?

<asp:TemplateField HeaderText="Speciality" SortExpression="DryLabTime">
                        <ItemTemplate>
                            <%#Eval("DryLabTime") == "Session1" ? "A" : 
                               (Eval("DryLabTime") == "Session2" ? "B" :
                               (Eval("DryLabTime") == "Session3" ? "C" :
                                (Eval("DryLabTime") == "Session4" ? "D" :
                                (Eval("DryLabTime") == "Session5" ? "E" :
                               "None"))))
                            %>
                        </ItemTemplate>
 </asp:TemplateField>

Open in new window


Thanks for your help
0
Comment
Question by:arthrex
1 Comment
 
LVL 25

Accepted Solution

by:
apeter earned 2000 total points
ID: 38350629
Yes you can . I think you might need one small change, "ToString()".


Eval("DryLabTime") .ToString() instead of just Eval("DryLabTime")
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 12 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question