Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Gridview RowCreated - way to change just first row command text?

Reply
Thread Tools

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

 
 
K B
Guest
Posts: n/a
 
      06-06-2006
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 ***
 
Reply With Quote
 
 
 
 
PeterKellner
Guest
Posts: n/a
 
      06-06-2006
On Tue, 06 Jun 2006 08:38:05 -0700, K B <(E-Mail Removed)>
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is RowCreated event good for removing columns from gridview footer? Bogdan ASP .Net 0 09-29-2008 06:14 PM
Gridview Rowcommand / Rowcreated question benji ASP .Net 0 02-29-2008 02:30 AM
GridView RowCreated Handler Issues bigbrorpi@gmail.com ASP .Net 2 10-25-2007 04:05 PM
GridView - RowCreated EventHandler doesn't work if page IsPostBack Paul ASP .Net 2 04-29-2007 01:48 PM
InputAttributes in RowCreated (gridview) Pipo ASP .Net 1 04-01-2006 05:28 PM



Advertisments