Gridview RowCreated - way to change just first row command text?

Discussion in 'ASP .Net' started by K B, Jun 6, 2006.

  1. K B

    K B Guest

    Hi,

    Is there a way to change the EditText value on just the commandfield in
    the first row. In the RowCreated event...

    If e.Row.RowIndex = 0 Then
    ...change the edittext on the commandfield

    Thanks,
    Kit


    *** Sent via Developersdex http://www.developersdex.com ***
     
    K B, Jun 6, 2006
    #1
    1. Advertising

  2. K B

    PeterKellner Guest

    On Tue, 06 Jun 2006 08:38:05 -0700, K B <>
    wrote:

    >Hi,
    >
    >Is there a way to change the EditText value on just the commandfield in
    >the first row. In the RowCreated event...
    >
    > If e.Row.RowIndex = 0 Then
    > ...change the edittext on the commandfield
    >
    >Thanks,
    >Kit
    >
    >
    >*** Sent via Developersdex http://www.developersdex.com ***


    Make sure you change the command row to a template first. Then this
    code will do the trick:


    protected void GridView1_RowCreated(object sender,
    GridViewRowEventArgs e)
    {
    if (e.Row.RowType == DataControlRowType.DataRow)
    {

    if (e.Row.RowIndex == 0)
    {
    LinkButton lb = (LinkButton)
    e.Row.FindControl("LinkButton1");
    lb.Text = "newtextbutton";
    }
    }


    }
    Peter Kellner

    (posted the wrong post a minute ago)
    Peter Kellner
    http://peterkellner.net
     
    PeterKellner, Jun 6, 2006
    #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. Pipo
    Replies:
    1
    Views:
    667
    Teemu Keiski
    Apr 1, 2006
  2. Replies:
    2
    Views:
    3,321
    fiendiest
    Oct 25, 2007
  3. Paul
    Replies:
    2
    Views:
    2,948
  4. benji
    Replies:
    0
    Views:
    794
    benji
    Feb 29, 2008
  5. Bogdan
    Replies:
    0
    Views:
    602
    Bogdan
    Sep 29, 2008
Loading...

Share This Page