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

RadGrid Footer Acting LIke Table

7 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jaime Weise
Top achievements
Rank 1
Jaime Weise asked on 09 Sep 2009, 09:23 AM
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

7 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Sep 2009, 09:42 AM
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
0
Jaime Weise
Top achievements
Rank 1
answered on 09 Sep 2009, 06:23 PM

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.
0
Jaime Weise
Top achievements
Rank 1
answered on 09 Sep 2009, 08:27 PM
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?
0
Jaime Weise
Top achievements
Rank 1
answered on 09 Sep 2009, 08:37 PM

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?

0
Accepted
Shinu
Top achievements
Rank 2
answered on 10 Sep 2009, 04:49 AM
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
0
Jaime Weise
Top achievements
Rank 1
answered on 10 Sep 2009, 08:21 AM
Oh, yeah that will work. I just thought that there might be a more elegant way to do that. Thanks for that Shinu.
0
Princy
Top achievements
Rank 2
answered on 10 Sep 2009, 09:29 AM
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
Tags
Grid
Asked by
Jaime Weise
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Jaime Weise
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or