Click here to Skip to main content
13,189,324 members (66,860 online)
Rate this:
 
Please Sign up or sign in to vote.
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 10-Jan-13 22:25pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

do it like this:


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

your are using assignment operator instead of comparison operator.


Regards
Pawan
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  
Comments
vipul.it08 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.171016.2 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100