Visibility of link button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

My following code is not working

I have a gridview that contains a linkButton in a template field. I
want to set the visibility of the linkbutton based on a int field in a
database.

Selecting the proper field in editbindings gives this in the code


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

This generates the following error.
'int' does not contain a definition for 'parse'
 
My following code is not working

I have a gridview that contains a linkButton in a template field. I
want to set the visibility of the linkbutton based on a int field in a
database.

Selecting the proper field in editbindings gives this in the code

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

This generates the following error.
'int' does not contain a definition for 'parse'

Hi bobby,

Insted of int.parse try to use Convert.ToInt32 method.

Regards,
Alexander Kleshchevnikov
www.klalex.com
 
Back
Top