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

OnDatabound Issue

1 Answer 38 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Matthew asked on 26 Jan 2012, 10:46 AM
Hello,

I am trying to dynamically create totals in the footer column of a RadGrid that I am currently developing.  The user is able to build up a dynamic query based on a selection of fields which will return a user defined data set.  This data set contains the data type and aggregation which I intend to use to determine whether or not a column needs aggregation and whether it is a count, max etc.   At present I can't seem to get the following commands to fire on the databind:

ColumnCreated

DataBinding

DataBound


I have tried all of these and the only time the Grid hits these sub is when I alter the results set once it's bound, ie drag and drop a column for grouping.

Here is my aspx rad grid:
<telerik:RadGrid ID="rgResults" Skin="Vista" runat="server" AutoGenerateColumns="true"
                   AllowFilteringByColumn="True" AllowPaging="false" AllowSorting="True" ShowGroupPanel="true"
                   OnItemCommand="rgresults_ItemCommand" ShowFooter="true" OnDataBound="rgResults_DataBound"
                   OnDataBinding="rgResults_DataBinding" OnColumnCreated="rgResults_ColumnCreated">
                   <MasterTableView Width="100%" GroupLoadMode="Client" TableLayout="Fixed" UseAllDataFields="true">
                       <CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false"
                           ShowRefreshButton="false" />
                   </MasterTableView>
                   <GroupingSettings CaseSensitive="false" />
                   <ClientSettings AllowGroupExpandCollapse="True" ReorderColumnsOnClient="True" AllowDragToGroup="True"
                       AllowColumnsReorder="True">
                       <Resizing AllowColumnResize="true" />
                       <Selecting AllowRowSelect="True" EnableDragToSelectRows="true" />
                       <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                   </ClientSettings>
                   <GroupingSettings ShowUnGroupButton="true" />
                   <ExportSettings HideStructureColumns="true" />
                   <FooterStyle />
               </telerik:RadGrid>

 


This is the brief code behind for the data bind:

'Bind results
Dim Results As DataTable = objUDR.UserDefinedReports_RunReport(ViewState("SelectedUDR").ToString, Fields, GroupBy, Where, True)
       rgResults.DataSource = Results  
       rgResults.DataBind()

 

All of the other onBninding subs etc are standard and as mentioned are hit when an action is applied ot the grid after binding.

Any help would be great. 

Thanks

 

 

 

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 27 Jan 2012, 09:53 PM
Matthew:

I think the problem lies in the fact that you're using a mix of declarative and programmatic RadGrid creation here. I see that you have AutoGenerateColumns="true".

RadGrid does not support mixing declarative grid columns with grid columns added dynamically at runtime. You should either create all the columns in the grid programmatically, or else define them all in the ASPX file.

See the Footer aggregation not displaying.. thread for a very similar scenario with response from Telerik Support.

Hope this helps!
Tags
Grid
Asked by
Matthew
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or