Retrieve ButtonColumn Text

Discussion in 'ASP .Net Datagrid Control' started by Jason Callas, Mar 5, 2004.

  1. Jason Callas

    Jason Callas Guest

    The first column on my grid is a ButtonColumn type. I want to be able to get
    the Text value from withing the ItemCommand event.

    I know that e.Item.Cells(0).Text returns an empty string because the cell
    has a button control on it. So I thought I would use the control collection
    of the cell instead. Because it is a control I should be casting it as a
    specific type. Unfortunely this is returning a casting error.

    The following code returns and error:

    Dim symbol As String
    symbol = CType(e.Item.Cells(0).Controls(0),
    Web.UI.WebControls.Button).Text


    Error = System.InvalidCastException: Specified cast is not valid.


    Any thoughts would be appreciated.

    - Jason
     
    Jason Callas, Mar 5, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. BK Kim

    Retrieve ButtonColumn Text

    BK Kim, Apr 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    394
    BK Kim
    Apr 6, 2004
  2. Sathyaish

    Getting the text of the ButtonColumn

    Sathyaish, Sep 8, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    377
    john_teague
    Sep 8, 2005
  3. =?Utf-8?B?QmVu?=

    Change the Text of ButtonColumn in a DataGrid

    =?Utf-8?B?QmVu?=, Jan 23, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    867
    Christopher Reed
    Jan 24, 2006
  4. BK Kim

    Retrieve ButtonColumn Text

    BK Kim, Apr 6, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    122
    BK Kim
    Apr 6, 2004
  5. BK Kim

    Retrieve ButtonColumn Text

    BK Kim, Apr 6, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    196
    Brandon Germer
    Jun 4, 2004
Loading...

Share This Page