Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to use below syntax in asp.net C# 4.0

<asp:CheckBox ID="chkUserType" runat="server" Checked='<%# (Eval("UserType") = 0 ? false : true) %>' /><


i want to apply checked property (true / false ) from database.

Thanks in Advance.
Posted

do it like this:


<%#Eval("UserType")==0 ? false : true %>

your are using assignment operator instead of comparison operator.


Regards
Pawan
 
Share this answer
 
Hello

You Can not Used Like This

<asp:CheckBox ID="chkUserType" runat="server" Checked='<%# (Eval("UserType") = 0 ? false : true) %>' />

Please Use it is As Simle Like

:

<asp:CheckBox ID="chkUserType" runat="server" Checked='<%#(String) (Eval("UserType") == 0 ?"false" : "true") %>' />



I Hope Your Problem Will Solve IF Not then give me your Comment
 
Share this answer
 
Comments
Vipul J Patel 7-Feb-13 2:42am    
I'm getting an error like

Operator '==' cannot be applied to operands of type 'object' and 'int'

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