This is a migrated thread and some comments may be shown as answers.

if else in itemtemplate

1 Answer 558 Views
Grid
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 19 Mar 2010, 07:32 AM
hi

How do i do a if else in item template? here is my code of what i am trying to accomplish:

 

<ItemTemplate>

 

<%

#IIf(DataBinder.Eval(Container.DataItem, "SupportingDocument") = "None","None","<a href="#" onclick='openRadWindow2('<%#DataBinder.Eval(Container.DataItem,"SupportingDocument")%>'); return false;">Supporting Document</a>)%>

 

 

</ItemTemplate>

Thanks

 

1 Answer, 1 is accepted

Sort by
0
Accepted
Veli
Telerik team
answered on 23 Mar 2010, 06:09 PM
Hi L,

Try the following instead:

<%#IIf(DataBinder.Eval(Container.DataItem, "Name").ToString() = "None", "None", "<a href='#' onclick='openRadWindow2(""" + DataBinder.Eval(Container.DataItem, "Name").ToString() + """); return false;'>Supporting Document</a>")%>


Sincerely yours,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
L
Top achievements
Rank 1
Answers by
Veli
Telerik team
Share this question
or