Hi,
I'm trying to establish a filter-drop-down as described in this demo.
It basically works out BUT as the combo contains > 10k of possible entries, LoadONDemadn became mandatory.
It basicall does work out with the following configuration:
However, when i remove the text in the filter-dropdown (i.e.try to filter for another record). i get a "Parameter cannot be null exception" which is due to the intermediate filter entry having no value, but the filter tries to sort i think?
Is there a way to overcome this issue? Any hint is highly appreciated.
I'm trying to establish a filter-drop-down as described in this demo.
It basically works out BUT as the combo contains > 10k of possible entries, LoadONDemadn became mandatory.
It basicall does work out with the following configuration:
<
telerik:GridDropDownColumn
DataSourceID
=
"DataSource"
ListTextField
=
"name"
ListValueField
=
"kID"
DataField
=
"cdf"
FilterControlAltText
=
"Filter cdf column"
HeaderText
=
"cdf"
SortExpression
=
"cdf"
UniqueName
=
"cdf"
>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBoxCustomer"
DataSourceID
=
"Customers"
DataTextField
=
"name"
DataValueField
=
"kID"
EnableAutomaticLoadOnDemand
=
"true"
AppendDataBoundItems
=
"true"
SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("cdf").CurrentFilterValue %>'
runat="server" ItemsPerRequest="10" EnableVirtualScrolling="true" OnClientSelectedIndexChanged="TitleIndexChanged" Skin="Metro">
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"All"
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function TitleIndexChanged(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("cdf", args.get_item().get_value(), "EqualTo");
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridDropDownColumn
>
However, when i remove the text in the filter-dropdown (i.e.try to filter for another record). i get a "Parameter cannot be null exception" which is due to the intermediate filter entry having no value, but the filter tries to sort i think?
Is there a way to overcome this issue? Any hint is highly appreciated.
9 Answers, 1 is accepted
0

Michael
Top achievements
Rank 1
answered on 26 Nov 2012, 06:58 AM
If there is no solution for this right now, it would be enough to just have a textbox in the filter-column that applies the "contains" - filter to the drop-down values of the column, is that possible?
0
Hi,
The described behavior is strange. How you are removing the text of the combobox? I see that your code is almost identical to the one in the demo project you have referred. But in the demo there is no such problem and you could not remove the text, you could only select "All" item.
Most probably the problem you are facing is caused by the cleared text, if there is no item selected the get_item() function will return null and after that the get_value() method will throw an exception.
However, you could post your full page source code along with the code-behind file content and thus all the people who want to help you will be able to investigate your code for possible problems.
All the best,
Andrey
the Telerik team
The described behavior is strange. How you are removing the text of the combobox? I see that your code is almost identical to the one in the demo project you have referred. But in the demo there is no such problem and you could not remove the text, you could only select "All" item.
Most probably the problem you are facing is caused by the cleared text, if there is no item selected the get_item() function will return null and after that the get_value() method will throw an exception.
However, you could post your full page source code along with the code-behind file content and thus all the people who want to help you will be able to investigate your code for possible problems.
All the best,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Michael
Top achievements
Rank 1
answered on 29 Nov 2012, 07:18 AM
Hi,
well, basically the code posted in my last post is all i use.
It's basically a 1:1 copy of the demo with one exception: The radcombobox is set to
If so, it should be possible to reproduce this behaviour by enabling AutomaticLoadonDemand in your demo example?
Thanks for your help so far!
well, basically the code posted in my last post is all i use.
It's basically a 1:1 copy of the demo with one exception: The radcombobox is set to
EnableAutomaticLoadOnDemand
=
"true"
your explanation "Most probably the problem you are facing is caused by the cleared text,
if there is no item selected the get_item() function will return null
and after that the get_value() method will throw an exception." sounds logical.If so, it should be possible to reproduce this behaviour by enabling AutomaticLoadonDemand in your demo example?
Thanks for your help so far!
0
Hi,
I tried to replicate the issue you are facing with a sample project but everything is working as expected on my side.
I am attaching the sample project here, so you could test it.
Greetings,
Andrey
the Telerik team
I tried to replicate the issue you are facing with a sample project but everything is working as expected on my side.
I am attaching the sample project here, so you could test it.
Greetings,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Michael
Top achievements
Rank 1
answered on 05 Dec 2012, 07:18 AM
Hi,
your project works out as longs as you do NOT use a GridDropDown-column instead of a GridBoundColumn. I think thats where the problem is located.
So if, for your project you switch to following code, you will get the same "error" as i do:
This doesnt make sense in your case as ContactTitle is available in SQLDataSource1 too, but in may case i need to show an employeename, whereas the employee-ID is stored in the Grid-Datasource and i get the name from "SQLDataSource2"
Thank you for your help so far! Highly appreciated!
your project works out as longs as you do NOT use a GridDropDown-column instead of a GridBoundColumn. I think thats where the problem is located.
So if, for your project you switch to following code, you will get the same "error" as i do:
<
telerik:GridDropDownColumn
DataSourceID
=
"SqlDataSource2"
ListTextField
=
"ContactTitle"
ListValueField
=
"ContactTitle"
UniqueName
=
"ContactTitle"
DataField
=
"ContactTitle"
HeaderText
=
"Contact title"
HeaderStyle-Width
=
"200px"
>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"RadComboBoxTitle"
DataSourceID
=
"SqlDataSource2"
DataTextField
=
"ContactTitle"
EnableAutomaticLoadOnDemand
=
"true"
DataValueField
=
"ContactTitle"
Height
=
"200px"
AppendDataBoundItems
=
"true"
SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ContactTitle").CurrentFilterValue %>'
runat="server" OnClientSelectedIndexChanged="TitleIndexChanged">
<
Items
>
<
telerik:RadComboBoxItem
Text
=
"All"
/>
</
Items
>
</
telerik:RadComboBox
>
<
telerik:RadScriptBlock
ID
=
"RadScriptBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function TitleIndexChanged(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
tableView.filter("ContactTitle", args.get_item().get_value(), "EqualTo");
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridDropDownColumn
>
This doesnt make sense in your case as ContactTitle is available in SQLDataSource1 too, but in may case i need to show an employeename, whereas the employee-ID is stored in the Grid-Datasource and i get the name from "SQLDataSource2"
Thank you for your help so far! Highly appreciated!
0
Hello,
I tested the case again with the code you provided and it is still working as expected on my side. However, since you elaborated a bit more about your scenario I think you could find useful the approach demonstrated in this online demo application.
You could use ControlParameter for the SqlDataSource of the DropDownControl based on the selected value of RadGrid.
If this does not help you I will suggest to upload a runnable project that replicates the issue to some online storage and share the link so we could investigate the issue.
Greetings,
Andrey
the Telerik team
I tested the case again with the code you provided and it is still working as expected on my side. However, since you elaborated a bit more about your scenario I think you could find useful the approach demonstrated in this online demo application.
You could use ControlParameter for the SqlDataSource of the DropDownControl based on the selected value of RadGrid.
If this does not help you I will suggest to upload a runnable project that replicates the issue to some online storage and share the link so we could investigate the issue.
Greetings,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Michael
Top achievements
Rank 1
answered on 07 Dec 2012, 11:10 AM
Hallo!
i wonder why this is working on your side. Attached you can find the "demo project" you sent with the modifications i made.
To ensure, the filter does work but there are two things preventing a nice user experience:
1) After selecting "Owner" as contact-title, all owner entries are shown, but the filter-value is set to "All" again.
and, more important
2) When trying to filter for values starting with e.g. "ka" afterwards, the error will be thrown.
Attached two screenshots related tow the two items above. I will upload the project asap. Hope you can reproduce it on your side.
Regards, Michael
i wonder why this is working on your side. Attached you can find the "demo project" you sent with the modifications i made.
To ensure, the filter does work but there are two things preventing a nice user experience:
1) After selecting "Owner" as contact-title, all owner entries are shown, but the filter-value is set to "All" again.
and, more important
2) When trying to filter for values starting with e.g. "ka" afterwards, the error will be thrown.
Attached two screenshots related tow the two items above. I will upload the project asap. Hope you can reproduce it on your side.
Regards, Michael
0
Accepted
Hi,
I was able to replicate the issue and it is cause by the SelectedValue property. This property should not be used with LoadOnDemand enabled. Instead of this you could create one item in the ItemDataBound even of RadGrid and select it. Thus you will get persistence of the selected value and in the same time you will get rid off of the exception.
I have modified the project to illustrate the approach. Give it a try and check whether it is OK.
Regards,
Andrey
the Telerik team
I was able to replicate the issue and it is cause by the SelectedValue property. This property should not be used with LoadOnDemand enabled. Instead of this you could create one item in the ItemDataBound even of RadGrid and select it. Thus you will get persistence of the selected value and in the same time you will get rid off of the exception.
I have modified the project to illustrate the approach. Give it a try and check whether it is OK.
Regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0

Michael
Top achievements
Rank 1
answered on 14 Dec 2012, 09:36 AM
Thanks! This did the trick!