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

Grid Grouping problem...

2 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
mark baer
Top achievements
Rank 1
mark baer asked on 22 Feb 2011, 06:58 PM
I am trying to drag a "Status" column to the Grouping header and I get the Javascript error  below:

Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: <target>.Expense and <source>.Expense have conflicting properties: DataType property mismatch.

The Expense column is a Decimal column.  I entered all of the data so I know it is a number.  Some of the Expense values might be null, but that is it.  Any ideas?  Below is my grid HTML on the Aspx page.

thanks

mark

 <telerik:RadGrid ID="radGridProjects" Width="1400px" runat="server" AllowFilteringByColumn="True"
                            AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" GridLines="None"
                            ShowGroupPanel="True" PageSize="50" Skin="WebBlue"                   OnSelectedIndexChanged="radGridProjects_SelectedIndexChanged"
                            OnItemDataBound="radGridProjects_ItemDataBound" ShowFooter="True" 
                            OnNeedDataSource="radGridProjects_NeedDataSource" 
                            EnableLinqExpressions="False">
                            <ClientSettings AllowDragToGroup="True" AllowColumnsReorder="True">
                                <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="380" />
                            </ClientSettings>
                            <MasterTableView ShowGroupFooter="true" >
                                <GroupByExpressions>
                                    <telerik:GridGroupByExpression>
                                        <SelectFields>
                                            <telerik:GridGroupByField FieldAlias="Team" FieldName="Team" SortOrder="Ascending"
                                                HeaderText="Team"></telerik:GridGroupByField>
                                        </SelectFields>
                                        <GroupByFields>
                                            <telerik:GridGroupByField FieldAlias="Team" FieldName="Team" SortOrder="Ascending"
                                                HeaderText="Team"></telerik:GridGroupByField>
                                        </GroupByFields>
                                    </telerik:GridGroupByExpression>
                                </GroupByExpressions>
                                <CommandItemSettings ExportToPdfText="Export to Pdf" />
                                <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                    <HeaderStyle Width="20px" />
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                    <HeaderStyle Width="20px" />
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridButtonColumn CommandName="Select" DataTextField="Name" FilterControlAltText="Filter ProjectColumn column"
                                        SortExpression="Name" Text="Select" UniqueName="ProjectColumn" HeaderText="Project">
                                        <HeaderStyle Width="150px" />
                                        <ItemStyle Width="150px" VerticalAlign="Top" />
                                    </telerik:GridButtonColumn>
                                    <telerik:GridBoundColumn DataField="Category.Name" FilterControlAltText="Filter column1 column"
                                        HeaderText="Category" UniqueName="colCategory" SortExpression="Category.Name">
                                        <HeaderStyle Width="115px" />
                                        <ItemStyle Width="115px" VerticalAlign="Top" HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Priority" FilterControlAltText="Filter column column"
                                        HeaderText="Priority" SortExpression="Priority" UniqueName="colPriority" FilterControlWidth="25px">
                                        <HeaderStyle Width="65px" />
                                        <ItemStyle Width="65px" VerticalAlign="Top" HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="StartDate" DataFormatString="{0:d}" DataType="System.DateTime"
                                        FilterControlAltText="Filter column2 column" HeaderText="Start Date" UniqueName="colStartDate"
                                        FilterControlWidth="60px" SortExpression="StartDate">
                                        <HeaderStyle Width="100px" />
                                        <ItemStyle Width="100px" VerticalAlign="Top" HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="EndDate" DataFormatString="{0:d}" FilterControlAltText="Filter column3 column"
                                        HeaderText="End Date" UniqueName="colEndDate" FilterControlWidth="60px" SortExpression="EndDate">
                                        <HeaderStyle Width="100px" />
                                        <ItemStyle Width="100px" VerticalAlign="Top" HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="ParStatus.Name" FilterControlAltText="Filter column4 column"
                                        HeaderText="Status" SortExpression="ParStatus.Name" UniqueName="colStatus">
                                        <HeaderStyle Width="115px" />
                                        <ItemStyle Width="115px" VerticalAlign="Top" HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Team" FilterControlAltText="Filter column5 column"
                                        HeaderText="Team" SortExpression="Team" UniqueName="colTeam" FilterControlWidth="30px">
                                        <HeaderStyle Width="70px" />
                                        <ItemStyle Width="70px" VerticalAlign="Top" HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="ProjectManager" FilterControlAltText="Filter column6 column"
                                        HeaderText="PM" SortExpression="ProjectManager" UniqueName="colPM" FilterControlWidth="30px">
                                        <HeaderStyle Width="70px" />
                                        <ItemStyle Width="70px" VerticalAlign="Top" HorizontalAlign="Center" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Resource" FilterControlAltText="Filter column7 column"
                                        HeaderText="Resources" SortExpression="Resource" UniqueName="colResource" 
                                        AllowFiltering="False">
                                        <HeaderStyle Width="125px" />
                                        <ItemStyle Width="125px" VerticalAlign="Top" HorizontalAlign="Left" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Expense" DataType="System.Int32" FilterControlAltText="Filter column8 column"
                                        HeaderText="Expense" SortExpression="Expense" UniqueName="colExpense" DataFormatString="{0:C0}"
                                        FilterControlWidth="50px" FooterText="Totals: " Aggregate="Sum">
                                        <HeaderStyle Width="90px" />
                                        <FooterStyle HorizontalAlign="Right" />
                                        <ItemStyle Width="90px" VerticalAlign="Top" HorizontalAlign="Right" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Capital" DataType="System.Int32" FilterControlAltText="Filter column9 column"
                                        HeaderText="Capital" SortExpression="Capital" UniqueName="colCapital" DataFormatString="{0:C0}"
                                        FilterControlWidth="50px" FooterText="$" Aggregate="Sum">
                                        <HeaderStyle Width="90px" />
                                        <FooterStyle HorizontalAlign="Right" />
                                        <ItemStyle Width="90px" VerticalAlign="Top" HorizontalAlign="Right" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Total" DataType="System.Int32" FilterControlAltText="Filter column10 column"
                                        HeaderText="Total" SortExpression="Total" UniqueName="colTotal" DataFormatString="{0:C0}"
                                        FilterControlWidth="50px" FooterText="$" Aggregate="Sum">
                                        <HeaderStyle Width="90px" />
                                        <FooterStyle HorizontalAlign="Right" />
                                        <ItemStyle Width="90px" VerticalAlign="Top" HorizontalAlign="Right" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Notes" FilterControlAltText="Filter column11 column"
                                        HeaderText="Notes" SortExpression="Notes" UniqueName="colNotes" 
                                        AllowFiltering="False">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Id" FilterControlAltText="Filter column12 column"
                                        UniqueName="colId" Visible="False">
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="LastUpdate" DataFormatString="{0:d}" 
                                        FilterControlAltText="Filter column column" SortExpression="LastUdate" HeaderText="Updated" 
                                        UniqueName="colLastUpdate" FilterControlWidth="60px">
                                        <HeaderStyle Width="100px" />
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />
                                    </telerik:GridBoundColumn>
                                </Columns>
                                <EditFormSettings>
                                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                    </EditColumn>
                                </EditFormSettings>
                            </MasterTableView>
                            <FilterMenu EnableImageSprites="False">
                            </FilterMenu>
                            <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
                            </HeaderContextMenu>
                        </telerik:RadGrid>

2 Answers, 1 is accepted

Sort by
0
Bodevain Svensson
Top achievements
Rank 1
answered on 23 Feb 2011, 09:23 AM

mark, from your grid definition I see that you explicitly specified the DataType of the Expense column to be Int32:

<telerik:GridBoundColumn DataField="Expense" DataType="System.Int32" FilterControlAltText="Filter column8 column"
                                        HeaderText="Expense" SortExpression="Expense" UniqueName="colExpense" DataFormatString="{0:C0}"
                                        FilterControlWidth="50px" FooterText="Totals: " Aggregate="Sum">
                                        <HeaderStyle Width="90px" />
                                        <FooterStyle HorizontalAlign="Right" />
                                        <ItemStyle Width="90px" VerticalAlign="Top" HorizontalAlign="Right" />
                                    </telerik:GridBoundColumn>

You said that the type of the values in the column are decimal, therefore this may cause a collision when you perform grouping operation. Either remove the DataType property of the column or set it to System.Decimal to see whether this helps.

Bodevain
0
mark baer
Top achievements
Rank 1
answered on 23 Feb 2011, 06:20 PM
Yes, that was the problem.  I changed it to decimal and the problem went away. 

thanks

mark
Tags
Grid
Asked by
mark baer
Top achievements
Rank 1
Answers by
Bodevain Svensson
Top achievements
Rank 1
mark baer
Top achievements
Rank 1
Share this question
or