Click here to Skip to main content
15,921,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<asp:TemplateField HeaderText="Task" HeaderStyle-BackColor="DarkBlue" HeaderStyle-ForeColor="White" ItemStyle-Width="5px">
                   if<%#DataBinder.Eval(Container.DataItem, "stat")%>=="S2"
                   <a href="QP_OJT.aspx?Emp_id=<%#DataBinder.Eval(Container.DataItem, "EMP_ID")%>&Train_B_N=<%#DataBinder.Eval(Container.DataItem, "Train_B_N")%>&Train_ID=<%#DataBinder.Eval(Container.DataItem, "Train_ID")%>" class="btn btn-primary btn-sm">QP-003/05/02</a>
                   <a href="QP_Eval.aspx?Train_ID=<%#DataBinder.Eval(Container.DataItem, "Train_ID")%>" class="btn btn-primary btn-sm">QP-003/09/03</a>

this 2 buttons actually in same column.

What I have tried:

if stat = "s2",QP-003/05/02 visible = true,else QP-003/05/02 is visible is false. please guide me on this,thank you.
Updated 10-Jul-16 22:57pm
Kornfeld Eliyahu Peter 11-Jul-16 3:02am    
This salad is poorly made...
Let me ask you a question. How you came by this code?
And an other question. What actually do you want to achieve?
KyLim0211 11-Jul-16 3:26am    
actually i want a if else statement in html

1 solution

    <asp:PlaceHolder runat="server" Visible='<%#Eval("stat")=="S2" %>'>
        <a href="#">S2 link</a>
    <asp:PlaceHolder runat="server" Visible='<%#Eval("stat")!="S2" %>'>
        <a href="#">Non-S2 link</a>
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900