How to add a footer row?

2 posts, 0 answers
  1. chris lively
    chris lively avatar
    11 posts
    Member since:
    Sep 2009

    Posted 28 Sep 2010 Link to this post

    I have a radgrid with the following definition
            <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="True"
                GridLines="None" Skin="Web20" OnPreRender="RadGrid1_PreRender"

            <MasterTableView EditMode="InPlace" CommandItemDisplay="Bottom">
                    <HeaderStyle Width="20px"></HeaderStyle>

                    <HeaderStyle Width="20px"></HeaderStyle>
                    <telerik:GridBoundColumn ConvertEmptyStringToNull="False" DataField="Name"
                        HeaderText="Name Column" MaxLength="50" ReadOnly="True" UniqueName="NameColumn">
                    <asp:Button runat="server" Text="Save All" ID="SaveButton" visible="true" CommandName="UpdateAll" />

    Most of the columns come from a databound source.  I need to add an additional row where there is a single checkbox for each column. For example (forgive the ascii art):
    |Name Column |Col 1              | Col 2             | Col 3             |
    |Some Name    | <drop down> | <drop down> | <drop down>|
    |Another Name | <drop down> | <drop down> |<drop down> |
    | Check These | <checkbox>   | <checkbox>   | <checkbox> |
    |<submit button>                                                                  |

    I have it creating all of the drop down lists in the CreateColumnEditor event. Also, all of the rows (except the checkbox one) come from the datasource.

    How can I add footer row that contains those checkboxes?
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 29 Sep 2010 Link to this post

    Hello Chris,
     In itemCreated event loop through each column and add Checkbox for each column's footer. Sample code is given below.

    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
            if (e.Item is GridFooterItem)
                GridFooterItem fitem=(GridFooterItem) e.Item;
                foreach(GridColumn column in RadGrid1.MasterTableView.AutoGeneratedColumns)
                    CheckBox chkbx = new CheckBox();

    Note: set ShowFooter of RadGrid as 'true' .

  3. DevCraft R3 2016 release webinar banner
Back to Top