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
 
Hi bobby,

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

Regards,
Alexander Kleshchevnikovwww.klalex.com

it could be looking for int.Parse (capital P)?
 

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

Back
Top