Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello,

i'm developing a small website n now i'm facing a problem. I designed my Sql table so that when ever I'm signed in, i set one of my field as "1" and when i log out, it changes to "0". So, I want to set some of the control's visibility so that some should be visible only when I'm signed in.
I tried using ternary operator like this:

<asp:LinkButton ID="LinkButtondelete" runat="server" CommandName="Delete" Visible="'<%#Eval("onlinestat") %>'==1?true:false">Delete

But, I'm getting an error. Someone please help me out..

thanks in advance,
Ajay.
Posted

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 22-Apr-13 2:18am    
Right link, a 5,
—SA
Naz_Firdouse 22-Apr-13 2:19am    
Thanks Sergey...
Try below code

C#
<asp:linkbutton id="LinkButtondelete" runat="server" commandname="Delete" visible="<%# Convert.ToBoolean(Convert.ToInt32(Eval("onlinestat"))) %>" xmlns:asp="#unknown">Delete</asp:linkbutton> 
 
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