RadGrid Footer Acting LIke Table

8 posts, 1 answers
  1. Jaime Weise
    Jaime Weise avatar
    25 posts
    Member since:
    Nov 2008

    Posted 09 Sep 2009 Link to this post

    Hi there,

    I have a Grid and I have templated the Footer. The problem is that the footer's content is starting half way. The effect is as if the footer is placing content in the second cell of a table.

    <table>
        <tr><td>Can't get my content to align over here.<td>    <td> Content in the template starts here                   </td> </tr>
    </table>

    The above code is to sort of visual represent the problem I am having. I am not using tables in my template at all. I am just curious why the content isn't able to align left.

    Any help would be greatly appreciated, thanks!

    Jaime
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Sep 2009 Link to this post

    Hi Jaime,

    I hope you are trying to align the text in the FooterTemplate of a GridTemplateColumn to the left. If so try with the following approach and see whether it helps.

    ASPX:
     
     <FooterStyle  HorizontalAlign="Left" /> 
                    <MasterTableView Width="100%" CommandItemDisplay="Top"   > 
                        <Columns> 
                           
                            <telerik:GridTemplateColumn UniqueName="TempCol" HeaderText="TempCol"  > 
                              <ItemTemplate> 
                                '<%#Eval("ProductName") %> 
                              </ItemTemplate> 
                              <FooterTemplate> 
                                My Footer text 
                              </FooterTemplate> 
                            </telerik:GridTemplateColumn> 
                        </Columns> 
                         
                    </MasterTableView> 


    Thanks
    Shinu
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jaime Weise
    Jaime Weise avatar
    25 posts
    Member since:
    Nov 2008

    Posted 09 Sep 2009 Link to this post


    No, unfortunately it is not an alignment issue. The second column in the gridview continues into the footer and the footer template starts from the second column it seems.
  5. Jaime Weise
    Jaime Weise avatar
    25 posts
    Member since:
    Nov 2008

    Posted 09 Sep 2009 Link to this post

    In fact this is the exact markup that is created for the footer after further inspection through firebug.


    <tfoot>
      <tr class="rgFooter">
       <td> </td><td align="left">
        ... removed for clarity.           
        <td>
      </tr>
     </tfoot>

    Any way to add a colspan to that td in the footer element?
  6. Jaime Weise
    Jaime Weise avatar
    25 posts
    Member since:
    Nov 2008

    Posted 09 Sep 2009 Link to this post


    Well, apparently I didn't notice that each grid column has a footer template. Is there any footer for the whold grid that I could more easily lay content accross teh whole width of the grid kind of like the form template?

  7. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 09 Sep 2009 Link to this post

    Hi Jaime,

    FooterTemplate is available only for a GridTemplateColumn and not for the entire RadGrid. Can you give a try with the following workaround and see whether it helps.

    ASPX:
     
     <telerik:GridTemplateColumn UniqueName="TempCol" DataField="Test" HeaderText="TempCol"
                                <ItemTemplate> 
                                 <%#Eval("Test")%> 
                                </ItemTemplate> 
                                <FooterTemplate> 
                                    My Footer text 
                                </FooterTemplate> 
                                <FooterStyle BackColor="pink" /> 
                            </telerik:GridTemplateColumn> 


    CS:
     
    protected void RadGrid2_ItemCreated(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridFooterItem) 
            { 
                GridFooterItem footer = ((GridFooterItem)e.Item); 
                int index = RadGrid2.Columns.Count; 
                footer["TempCol"].ColumnSpan = index; 
            }   
             
        } 
     


    Regards
    Shinu
  8. Jaime Weise
    Jaime Weise avatar
    25 posts
    Member since:
    Nov 2008

    Posted 10 Sep 2009 Link to this post

    Oh, yeah that will work. I just thought that there might be a more elegant way to do that. Thanks for that Shinu.
  9. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Sep 2009 Link to this post

    Hi Jamie,

    You may also make use of the Grid's CommandItemTemplate. Set the CommandItemDisplay property to Bottom to make the CommandItemTemplate appear in the bottom.

    ASPX:
     
     
     <MasterTableView  CommandItemDisplay="Bottom" > 
                        <CommandItemStyle  BackColor="PowderBlue" /> 
                        <CommandItemTemplate> 
                          My Footer Text 
                        </CommandItemTemplate> 


    Thanks
    Princy
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017