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

How to adjust footer (colspan)

2 Answers 466 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Arteta Sam
Top achievements
Rank 1
Arteta Sam asked on 10 Apr 2011, 07:43 AM
Dear all,

Hi, i want to put footer in my Radgrid. However, what i done just now is like attachment.
I cant fixed the background of footer.it always out of the masterview and radgrid.
<telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server" AllowAutomaticDeletes="True" FooterStyle-Width="100px"
                ShowFooter="true" OnNeedDataSource="RadGrid1_NeedDataSource" AllowAutomaticInserts="True"
                PageSize="10" AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False"
                OnItemDataBound="RadGrid1_ItemDataBound" DataSourceID="SqlDataSource1" OnItemUpdated="RadGrid1_ItemUpdated"
                AllowFilteringByColumn="true" OnItemDeleted="RadGrid1_ItemDeleted" OnItemInserted="RadGrid1_ItemInserted"
                OnDataBound="RadGrid1_DataBound" ExportSettings-OpenInNewWindow="true" ExportSettings-Pdf-AllowPrinting="true"
                OnItemCreated="RadGrid1_ItemCreated" ExportSettings-Pdf-PageTitle="Financial Record"
                Skin="Hay">
                <PagerStyle Mode="NextPrevAndNumeric" />
<ExportSettings OpenInNewWindow="True">
<Pdf PageTitle="Financial Record"></Pdf>
</ExportSettings>
  
                <MasterTableView Width="950px" CommandItemDisplay="TopAndBottom" DataKeyNames="BudgetId" 
                    EditMode="EditForms" CommandItemSettings-AddNewRecordText="Add New Record" DataSourceID="SqlDataSource1"
                    HorizontalAlign="NotSet" AutoGenerateColumns="False">
<CommandItemSettings AddNewRecordText="Add New Record"></CommandItemSettings>
                    <Columns>
                    <%--footer--%>
                     <telerik:GridTemplateColumn UniqueName="footer1" DataField="footer1" ColumnEditorID="footerEditor" >
                            <ItemTemplate>
                            </ItemTemplate>
                            <HeaderStyle Width="950px" />
                            <ItemStyle Width="950px"  />
                            <FooterStyle Width="950px" />
                            <FooterTemplate>
                            <h3><asp:Label runat="server" ID="lblBudgetSummary" >Budget Summary</asp:Label></h3>
                            <table width="400px;">
                            <tr><td width="200px">Total</td><td width="200px"> <asp:Label ID="lblTotal" runat="server" Text='<%# Bind("Total2", "{0:F2}") %>'></asp:Label></td></tr>
                               <tr><td>Food</td><td><asp:Label ID="lblFood" runat="server" Text='<%# Bind("Total2", "{0:F2}") %>'></asp:Label></td></tr>
                                  <tr><td>Transport</td><td> <asp:Label ID="lblTransport" runat="server"></asp:Label></td></tr>
                                     <tr><td>Communication</td><td><asp:Label ID="lblCommunication" runat="server"></asp:Label></td></tr>
                                        <tr><td>Residence</td><td><asp:Label ID="lblResidence" runat="server"></asp:Label></td></tr>
                                           <tr><td>Clothing</td><td><asp:Label ID="lblClothing" runat="server"></asp:Label></td></tr>
                                              <tr><td>Health</td><td><asp:Label ID="lblHealth" runat="server"></asp:Label></td></tr>
                                                 <tr><td>Insurance</td><td> <asp:Label ID="lblInsurance" runat="server"></asp:Label></td></tr>
                                                    <tr><td>Leisure</td><td><asp:Label ID="lblLeisure" runat="server"></asp:Label></td></tr>
                                                       <tr><td>Education</td><td><asp:Label ID="lblEducation" runat="server"></asp:Label></td></tr>
                                                          <tr><td>Other</td><td><asp:Label ID="lblOther" runat="server"></asp:Label></td></tr>
                              
                              
                            </table>
                            </FooterTemplate>
                        </telerik:GridTemplateColumn>
                      <%--edit button--%>
                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" >
                        </telerik:GridEditCommandColumn>
                        <%--User ID (Visible)--%>
                       <%-- <telerik:GridBoundColumn DataField="UserId" HeaderText="UserId" SortExpression="UserId" Visible="false"
                            UniqueName="UserId" >
                        </telerik:GridBoundColumn>--%>
                        <%--Budget ID (visible) --%>
                       <%-- <telerik:GridBoundColumn DataField="BudgetId" HeaderText="BudgetId" SortExpression="BudgetId" Visible="false"
                            UniqueName="BudgetId" >
                        </telerik:GridBoundColumn>--%>
                        <%--Create Date --%>
                        <telerik:GridDateTimeColumn DataField="CreateDate" HeaderText="Date Added" SortExpression="CreateDate" ColumnEditorID="dtCreateDate"
                            MinDate="01/01/2011" HtmlEncode="false" UniqueName="CreateDate" DataType="System.DateTime"
                            DataFormatString="{0:dd/MMM/ yyyy}">
                            <HeaderStyle Font-Size="12px" />
                            <ItemStyle Font-Size="11px" />
                        </telerik:GridDateTimeColumn>
                        <%--category ID--%>
                        <telerik:GridDropDownColumn DataField="CategoryId" DropDownControlType="RadComboBox" 
                            HeaderText="Category" ListTextField="CategoryType" ListValueField="CategoryId"
                            UniqueName="CategoryId" DataSourceID="SqlDataSource2">
                        </telerik:GridDropDownColumn>
                        <%--record title--%>
                        <telerik:GridBoundColumn DataField="Description" HeaderText="Description" SortExpression="Description"
                            UniqueName="Description" EditFormColumnIndex="1" ColumnEditorID="GridTextBoxColumnEditor1">
                        </telerik:GridBoundColumn>
                        <%--Amount--%>
                        <telerik:GridNumericColumn DataField="Amount" HeaderText="Amount" SortExpression="Amount"
                            DataFormatString="{0:C}" UniqueName="Amount" EditFormColumnIndex="1" ColumnEditorID="GridTextBoxColumnEditor3">
                        </telerik:GridNumericColumn>
                        <%--Carry forward--%>
                        <telerik:GridCheckBoxColumn DataField="CarryForward" HeaderText="Carry Forward" SortExpression="CarryForward" ColumnEditorID="chkCarryForward"
                            UniqueName="CarryForward" EditFormColumnIndex="1">
                        </telerik:GridCheckBoxColumn>
                        <%--delete row data popup--%>
                        <telerik:GridButtonColumn ConfirmText="Delete this account?" ConfirmDialogType="RadWindow" 
                            ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"
                            UniqueName="DeleteColumn">
                            <ItemStyle HorizontalAlign="Center" />
                        </telerik:GridButtonColumn>
                         
                    </Columns>
                    <%--Account Name Edit Form Settings--%>
                    <EditFormSettings ColumnNumber="1" CaptionDataField="RecordId" CaptionFormatString="Edit properties of Account {0}">
                        <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                        <FormCaptionStyle></FormCaptionStyle>
                        <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White"
                            Width="100%" />
                        <FormTableStyle CellSpacing="0" CellPadding="2" Height="110px" BackColor="White" />
                        <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                        <EditColumn ButtonType="ImageButton" InsertText="Insert Order" UpdateText="Update record"
                            UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                        </EditColumn>
                        <FormTableButtonRowStyle HorizontalAlign="Right"></FormTableButtonRowStyle>
                    </EditFormSettings>
                </MasterTableView>
                <ClientSettings>
                    <ClientEvents OnRowDblClick="RowDblClick" />
                </ClientSettings>
            </telerik:RadGrid>
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridEditableItem && e.Item.IsInEditMode)//Check for Edit mode. Here its InPlace.
       {
           GridEditableItem editItem = (GridEditableItem)e.Item;
           RadComboBox combo = (RadComboBox)editItem["CategoryId"].Controls[0];
           combo.AllowCustomText = true;
           combo.EmptyMessage = "=Select=";
       }
       if (e.Item is GridFooterItem)
       {
           GridFooterItem footer = ((GridFooterItem)e.Item);
           int index = RadGrid1.Columns.Count;
           footer["footer1"].ColumnSpan = 8;
          // footer["footer1"].Width = 10;
       }
How can i solve this problem?

Any help is appreciated.
Thank you.

regards,
Nasri

2 Answers, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 14 Apr 2011, 09:13 AM
Hello Nasri,

In order to achieve the desired look, I recommend that you set the TableLayout of the MasterTableView to fixed, remove all ItemStyle-Width properties from the columns declaration and remove the FooterStyle-Width="100px" setting of the MasterTableView.

Please give these suggestions a try and let me know how it goes.

Kind regards,
Mira
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Arteta Sam
Top achievements
Rank 1
answered on 16 Apr 2011, 11:22 AM
Dear MIra,

Thank you for your solution, it works well.
Tags
Grid
Asked by
Arteta Sam
Top achievements
Rank 1
Answers by
Mira
Telerik team
Arteta Sam
Top achievements
Rank 1
Share this question
or