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

  • Thread starter Thread starter K B
  • Start date Start date
K

K B

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
 
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

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
 

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