get GridButtonColumn by UniqueName

3 posts, 0 answers
  1. Michael Nagy
    Michael Nagy avatar
    18 posts
    Member since:
    May 2008

    Posted 22 Dec 2008 Link to this post

    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. Daniel
    Admin
    Daniel avatar
    4945 posts

    Posted 22 Dec 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 22 Dec 2008 Link to this post

    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.
Back to Top