link button

G

Guest

My following code is not working

<asp:LinkButton ID="btnRemoveAll" runat="server"
Visible='<%#(int.parse(Eval("UserCnt")!=0)) %>'
OnClick="btnRemoveAll_Click">Remove All</asp:LinkButton><br />
 
N

Nathan Sokalski

It looks to me like you might have your parentheses misplaced. Try changing
your databinding expression to the following:

'<%#(int.parse(Eval("UserCnt"))!=0) %>'

It can sometimes be a little tricky doing calculation inside databinding
expressions. If you haven't done it already, I would do a few tests to make
sure that the specific pieces of the expression are returning what you
expect (For example, make sure Eval("UserCnt") and
int.parse(Eval("UserCnt")) return what you expect). Also, because Eval
returns an Object and parse accepts a String, you may want to cast
Eval("UserCnt") as a String before sending it to parse. I won't make any
promises that any of these will work, but hopefully they will be worth
something. Good Luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,269
Latest member
vinaykumar_nevatia23

Latest Threads

Top