This is a migrated thread and some comments may be shown as answers.

get GridButtonColumn by UniqueName

2 Answers 765 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael Nagy
Top achievements
Rank 2
Michael Nagy asked on 22 Dec 2008, 03:05 PM
hello Everybody ,
i have a question and i need reply ASAP ...
i have radgrid with GridButtonColumn

 <telerik:GridButtonColumn UniqueName="ActivateColumn" CommandName="Activation" Text="DeActivate" />

and there is ItemDataBound Event handller which i want to get the GridButtonColumn in this handler
what can i do ???

  protected void Radgrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
            ObjectType currentEntity = e.Item.DataItem as ObjectType ;
            if (ObjectType != null)
            {          
               // i want to get  GridButtonColumn  here to change it's text and command name , .....
                GridButtonColumn  x = e.Item.FindControl("ActivateColumn");
                x.Text = "xxxxx" ;
                x.CommandName = "XXX";
            }
    }

2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 22 Dec 2008, 03:16 PM
Hello Michael,

Please test the following modification:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    GridDataItem item = e.Item as GridDataItem; 
    if (item != null
    { 
        LinkButton button = item["ActivateColumn"].Controls[0] as LinkButton; 
        button.Text = "xxxxx"
        button.CommandName = "XXX"
    } 

I hope this helps.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Shinu
Top achievements
Rank 2
answered on 23 Dec 2008, 04:44 AM
Hi Michael,

You can also refer the following help article whic explains how to access cells and rows in RadGrid.
Accessing cells and rows

Shinu.
Tags
Grid
Asked by
Michael Nagy
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Shinu
Top achievements
Rank 2
Share this question
or