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

Radgrid filtering with combobox

1 Answer 213 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kiran
Top achievements
Rank 1
Kiran asked on 18 May 2010, 06:34 PM
Hi telerik,

I have a simple grid with the filter options, I am trying to apply filter functionality by textbox(working fine) and combobox column, but combobox filter is not working at all, below is my code and please help asap.

<

 

telerik:RadGrid AutoGenerateColumns="False" ID="RadGrid1"

 

 

AllowFilteringByColumn="True"

 

 

ClientSettings-Scrolling-ScrollHeight="500"

 

 

ClientSettings-Scrolling-UseStaticHeaders="true"

 

 

ClientSettings-Scrolling-AllowScroll="true" OnPreRender="RadGrid1_PreRender"

 

 

ClientSettings-Selecting-AllowRowSelect="true" EnableLinqExpressions="true"

 

 

AllowSorting="True" runat="server">

 

 

<GroupingSettings CaseSensitive="false" />

 

 

<MasterTableView >

 

 

<Columns>

 

 

<telerik:GridBoundColumn HeaderText="Employee Number" DataField="KEYID"

 

 

UniqueName="KEYID" SortExpression="KEYID" FilterControlWidth="30px"

 

 

Visible="false" ShowFilterIcon="false" />

 

 

<telerik:GridBoundColumn HeaderText="Employee Name" DataField="Name" UniqueName="Name"

 

 

SortExpression="Name" HeaderStyle-Width="300px" FilterControlWidth="140px"

 

 

AutoPostBackOnFilter="true" CurrentFilterFunction="contains" ShowFilterIcon="false" />

 

 

<telerik:GridBoundColumn HeaderText="SSN" DataField="EMP_SSN" HeaderStyle-Width="205px"

 

 

UniqueName="SSN" SortExpression="EMP_SSN"

 

 

FilterControlWidth="90px" AutoPostBackOnFilter="true" CurrentFilterFunction="contains"

 

 

ShowFilterIcon="false" />

 

 

<telerik:GridBoundColumn HeaderText="Pay Period" DataField="CODE" HeaderStyle-Width="205px"

 

 

UniqueName="CODE" >

 

 

 

<FilterTemplate>

 

 

<telerik:RadComboBox ID="RadComboBoxPP" DataSourceID="SqlDataSource4" DataTextField="Code"

 

 

DataValueField="Code" Height="100px" AppendDataBoundItems="true" AutoPostBack="true"

 

 

SelectedValue='<%# TryCast(Container, GridItem).OwnerTableView.GetColumn("Code").CurrentFilterValue %>'

 

 

runat="server" OnClientSelectedIndexChanged="PPIndexChanged"  >

 

 

<Items>

 

 

<telerik:RadComboBoxItem Text="All" />

 

 

</Items>

 

 

</telerik:RadComboBox>

 

 

<telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">

 

 

<script type="text/javascript">

 

 

function PPIndexChanged(sender,args) {

 

 

var tableView=$find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID%>");

 

 

tableView.filter("Code",args.get_item().get_value(),"EqualTo");

 

}

 

</script>

 

 

</telerik:RadScriptBlock>

 

 

</FilterTemplate>

 

 

</telerik:GridBoundColumn>

 

 

 

</Columns>

 

 

</MasterTableView>

 

 

<ClientSettings>

 

 

<ClientEvents OnRowSelected="RowSelected" />

 

 

</ClientSettings>

 

 

</telerik:RadGrid>

 

 

<asp:SqlDataSource ID="SqlDataSource4" runat="server"></asp:SqlDataSource>

 




Kiran

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 19 May 2010, 11:04 AM
Hi Kiran,

I reviewed the setup, and noticed that you set the AutoPostBack property of the RadComboBox to true. Please try to set it to false and let me know if the problem still persists.

Additionally, I suggest you examine the online resources below, which elaborate on this subject:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/filtertemplate/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/radgridfiltertemplate.html 

Sincerely yours,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Kiran
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or