I have this repeater on my page. In the default column, I want it to be an IF condition that checks the value of the table field "IsDEfault". If IsDefault = True, then under the table below "label1", that is, "Yes" should be displayed inside the repeater, the link "Make DEfault" should be displayed.
Now, how do I include this IF statement as inline code in the repeater to accomplish what I want?
<asp:LinkButton ID="lnk1" Text="Make Default" CommandName="SetDefault" runat="server" Visible="True" CommandArgument='<%#Eval("UserID") %>' CausesValidation="false"></asp:LinkButton> <asp:Label ID="label1" Text="Yes" runat="server" Visible="False"></asp:Label>
I have an idea: -
<%# If DataBinder.Eval(Container.DataItem,"IsDefault") = "True" Then%> <%End If%>
How do I now form the expression "Then"? Please help me with the correct syntax ..thnx Do I need to make a method that checks if IsDefault is true or not, and then calls it inside the inline code in my repeater? How can I do it?
[EDIT]
I tried to do the following: -
<% If (Eval("Container.DataItem,"IsDefault"")="True"? ("<asp:LinkButton ID="lnk1" Text="Set as Default" CommandName="SetDefault1" runat="server" CommandArgument='<%#Eval("User1ID") %>' CausesValidation="false" Visible=true></asp:LinkButton>") : ("<asp:Label ID="label1" Text="Yes" runat="server" Visible=true></asp:Label>") )%>
Doesn't work :( Help !!
Serenity
source share