I have a ASP.Net website, using Visual Studio 2008 and Telerik controls.
I am using a radGrid and Bind it to a dataset using the event NeedDataSource.
I have enabled Filtering and Sorting in the grid. Sorting works fine, but everytime I click on the filter button it gives me the following error:
Unable to cast object of type 'Telerik.Web.UI.RadGrid' to type 'Telerik.Web.UI.GridTableView'.
PLEASE advise, this is very important for us to be able to use the filtering.
Thanks,
Shirin
4 Answers, 1 is accepted
Can you send us small example where we can reproduce this problem?
Sincerely yours,
Vlad
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I also checked my Web.config file (as is posted in other threads) and everything matches. So I don't understand what the problem is .
Below is my ASPX page:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<
telerik:RadGrid runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False"
GridLines="Horizontal" ID="radGridPMData"
HorizontalAlign="Center" Skin="WebBlue" Width="765px"
AllowFilteringByColumn="True"
onneeddatasource="radGridPMData_NeedDataSource"
PageSize="25">
<PagerStyle Mode="NextPrevAndNumeric" VerticalAlign="Middle" />
<MasterTableView AllowFilteringByColumn="true" DataKeyNames="Job_RKey" >
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="Job_RKey" UniqueName="Job_Key"
Visible="False"
>
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Job_Number" HeaderText="Project Number"
UniqueName="Job_Number" AutoPostBackOnFilter="True">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Project_Title" HeaderText="Project Title"
UniqueName="Project_Title" AutoPostBackOnFilter="True" AllowFiltering="true" >
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Employee" HeaderText="Employee"
UniqueName="Employee" AutoPostBackOnFilter="True">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Date_Created" HeaderText="Date"
UniqueName="Date_Created" DataFormatString="{0:d}"
DataType="System.DateTime" AutoPostBackOnFilter="True">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</telerik:GridBoundColumn>
<telerik:GridHyperLinkColumn HeaderText="Details" Text="View" UniqueName="view1"
NavigateUrl="pmsheet.aspx?jobKey=" DataNavigateUrlFields="Job_RKey"
DataNavigateUrlFormatString="pmsheet.aspx?jobKey={0}" AllowFiltering="False">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</telerik:GridHyperLinkColumn>
<telerik:GridHyperLinkColumn HeaderText="Report" Text="Report" UniqueName="rpt"
NavigateUrl="PMReport.aspx?jobKey=" DataNavigateUrlFields="Job_RKey"
DataNavigateUrlFormatString="PMReport.aspx?jobKey={0}" AllowFiltering="False">
<HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
</telerik:GridHyperLinkColumn>
</Columns>
</MasterTableView>
<SelectedItemStyle BackColor="#CCFFFF" />
<FilterMenu EnableTheming="True">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
</FilterMenu>
</telerik:RadGrid>
</form>
Did you get a chance to look at my code?
Please let me know what the issue is, since this is very critical for us.
Thanks.
We tried to reproduce this behavior but unfortunately without avail. Please test the attached website based on the code you provided and let us know whether it is working as expected.
Regards,
Daniel
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.