Link to home
Start Free TrialLog in
Avatar of Xbradders
Xbradders

asked on

How to put a switch (Case Select) in a Datagrid row

Can I put a switch inside of an <itemtemplate>?  I want to check a value, then substitute it with text in my DataGrid.  For example:

if DataBinder.Eval(Container.DataItem, "FruitID")= 1 then print "Apple"
if DataBinder.Eval(Container.DataItem, "FruitID")= 2 then print "orange"
if DataBinder.Eval(Container.DataItem, "FruitID")= 3 then print "grape"
Avatar of Eduard Ghergu
Eduard Ghergu
Flag of Romania image

Hi,
I recommend you to create a method server side that will contain the switch. You'll pass to it the Container.DataItem and you'll got a string with the value that you want to be displayed.
SOLUTION
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial