ASP.Net Grid Control Link Button

Discussion in 'ASP .Net' started by Robin, Aug 2, 2004.

  1. Robin

    Robin Guest

    In an ASP.NET page that has a data grid with a bound column of link button.
    How can I reference the control and set properties for the link button at
    run time?
    Robin, Aug 2, 2004
    #1
    1. Advertising

  2. Hi Robin,

    This is so simple!

    foreach (DataGridItem item in dgCustomers.Items)
    {
    TableCell cell = item.Cells[0];
    LinkButton button = (LinkButton) cell.Controls[0];
    button.Text = "some text";
    }


    The above example assumes that your DataGrid is named dgCustomers and the LinkColumn is the first column in DataGrid. That's why I have written Items.Cells[0]. You can reference any columns using its index through Items.Cells.

    The LinkButton has also other properties like NavigateUrl that you can set at run time.

    Hope this helps! Please feel free to ask any questions if you are still confused with this.

    Best Wishes,
    Mosh



    "Robin" <> wrote in message news:...
    > In an ASP.NET page that has a data grid with a bound column of link button.
    > How can I reference the control and set properties for the link button at
    > run time?
    >
    >
    Moshfegh Hamedani, Aug 2, 2004
    #2
    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. Yunus Emre ALPÖZEN [MCAD.NET]

    link data grid edit button

    Yunus Emre ALPÖZEN [MCAD.NET], May 9, 2005, in forum: ASP .Net
    Replies:
    13
    Views:
    689
    =?Utf-8?B?RWx0b24gVw==?=
    May 12, 2005
  2. John Smith
    Replies:
    0
    Views:
    463
    John Smith
    May 14, 2005
  3. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    798
    Kevin Spencer
    May 17, 2005
  4. Robin

    ASP.Net Grid Control Link Button

    Robin, Aug 2, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    111
    Matt Fischer
    Aug 2, 2004
  5. RCorona
    Replies:
    1
    Views:
    153
    Al Cadalzo
    Jan 1, 2005
Loading...

Share This Page