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

Grid Filtering

4 Answers 98 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shirin
Top achievements
Rank 1
Shirin asked on 09 Oct 2008, 03:03 PM

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

Sort by
0
Vlad
Telerik team
answered on 09 Oct 2008, 03:23 PM
Hello Shirin,

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.
0
Shirin
Top achievements
Rank 1
answered on 09 Oct 2008, 03:39 PM
Hi,
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>

 

0
Shirin
Top achievements
Rank 1
answered on 10 Oct 2008, 09:20 PM
Hi,

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.
0
Daniel
Telerik team
answered on 14 Oct 2008, 07:35 AM
Hello Shirin,

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.
Tags
Grid
Asked by
Shirin
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Shirin
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or