link button

  • Thread starter Thread starter Guest
  • Start date Start date
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 />
 
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!
 
Back
Top