Add a button to every row in RadGrid

2 posts, 0 answers
  1. Meghna
    Meghna avatar
    1 posts
    Member since:
    Jul 2016

    Posted 19 Jul 2016 Link to this post

    Hi all,

    I need to add a replace button to every row in the RadGrid. Any help is appreciated

    My code is as follows

    <div>     

    <telerik:RadGrid ID="grdVwPrecisionsources" runat="server" OnNeedDataSource="PrecisionSourcesDataGrid" Width="60%">        

    <ClientSettings>                            

     <Resizing AllowColumnResize="true" ResizeGridOnColumnResize="true" AllowResizeToFit="true" />                         

    </ClientSettings>       

    </telerik:RadGrid>

    <div>

    ascx.cs

    protected void PrecisionSourcesDataGrid(object sender, EventArgs e)         

    {                    

    var table = new DataTable();             

    table.Columns.Add("Source");             

    table.Columns.Add("ID");             

    table.Columns.Add("Name");             

    table.Columns.Add("Date");                          

    table.Columns.Add("Reminder");                          

    table.Columns.Add("Status");             

    table.Columns.Add(" ", typeof(string));       - This needs to be button column             

    table.Rows.Add("Point", "M6-515", "Co-57", "8/30/2016", "1 week to expiration", "Replace in 40 days", "");             

    table.Rows.Add("Point", "M6-515", "Co-57", "8/30/2016", "1 week to expiration", "Replace in 40 days", "");             

    grdVwPrecisionsources.DataSource = table;      

       }

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 22 Jul 2016 Link to this post

    Hello,

    Simply add ButtonColumn in the Grid definition:
    table.Columns.Add("Name", typeof(string));
     
    <telerik:GridButtonColumn Text='<%# Eval("Name") %>'
        UniqueName="NameColumn" >
    </telerik:GridButtonColumn>


    Regards,
    Maria Ilieva
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top