http://www.telerik.com/demos/aspnet/prometheus/Grid/Examples/GeneralFeatures/Filtering/DefaultCS.aspx
I've tried to change this example
because i want that at page load filter is not visible.
If user need filter then click on the radio group.
How it's possibile to do this?
Thanks for your hel
12 Answers, 1 is accepted
Here is an example:
<script type="text/javascript">
function pageLoad(sender, args)
{
$find('<%=RadGrid1.ClientID %>').get_masterTableView().hideFilterItem();
}
</script>
Regards,
Vlad
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
This is my scenario:
I have a RadMultiPage with two RadPageView
Every RadPageView contain an user control.
The user control contain a RadGrid with my personal code.
I have used your example im my user control.
Now i have this problem:
Your code is ok but only for the user control conatined in the first visible page of my RadMultiPage
How can i resolve it ?
I suppose that pageLoad event occur only for the visible page...
Please find attached a sample project where the filter items of the grids are hidden as expected. Try it on your end and let me know if I missed something from your logic.
Best wishes,
Iana
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Instead use function pageLoad as your sample,
i used GridCreated Client site event of radgird to execute code that hide filter items
<script type="text/javascript">
function GridCreated()
{
$find('<%=RadGrid1.ClientID %>').get_masterTableView().hideFilterItem();
}
</script>
In page load event, on my user control, i assigned this event at every grid.
So every thing work fine.
using pageLoad only the last grid worked fine.
Thank for your help, now i'll take a look to your sample
I have a problem with Ajax enabled but i think it's only because i dont'use RegisterScriptClient
Thanks!
You can find attached the sample modified so it uses checkbox to toggle the grid filter item visibility instead of radio button.
Let me know if any issues arise.
Sincerely yours,
Iana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Yes, you can hide the grid filter item initially. Try handling the ItemCreated event of RadGrid and hide the item as below:
| protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) |
| { |
| if (!IsPostBack && e.Item is GridFilteringItem) |
| { |
| e.Item.Style["display"] = "none"; |
| } |
| } |
I hope this helps.
Kind regards,
Iana
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.
I used to have this working with a checkbox server side where I would set the Allowfilteringbycolumn = true when the check box changed.
Upgrading to the new version broke this. I have a new custom drop down list for filtering.
If i do not turn on filetreing by default I get a null reference error on the filtering column javascript.
<telerik:GridBoundColumn UniqueName="Status" DataField="Status" HeaderText="Status" >
<FilterTemplate>
<telerik:RadComboBox ID="RadComboBoxStatus" DataSourceID="SqlDataSource2" DataTextField="Status"
DataValueField="Status" AppendDataBoundItems="true" SelectedValue='<%# TryCast(Container,GridItem).OwnerTableView.GetColumn("Status").CurrentFilterValue %>'
runat="server" OnClientSelectedIndexChanged="StatusIndexChanged">
<Items>
<telerik:RadComboBoxItem Text="All" />
</Items>
</telerik:RadComboBox>
<script type="text/javascript">
function StatusIndexChanged(sender, args) {
var tableView = $find("<%# TryCast(Container,GridItem).OwnerTableView.ClientID %>");
tableView.filter(
"Status", args.get_item().get_value(), "EqualTo");
}
</script> </FilterTemplate>
</telerik:GridBoundColumn>
I would sure love to see a server side solution for a grid with a custom drop down list to hide and show filters server side .
Anywhere to point me ?
You can ajaxify the grid using RadAjaxManager or RadAjaxPanel to avoid the plain postback when the filtering item has to be shown/hidden. Another option would be to use client-side approach as demonstrated on this online demo:
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/filtering/defaultcs.aspx (taking advantage of the showFilterItem()/hideFilterItem methods from the client-side API of the control)
Best regards,
Sebastian
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I do have the grid in an Ajax panel with a script manager.... not the Rad ones, but it's there.
Here is the problem. Take that example and turn OFF filtering by default then run it and you get javascript errors because the items are not created yet.
In mine the ajax update panel never gets hit since this is all happening client side and there is nothing really AJAX about it. The screen display is changing.
I'd still like to see the example modified to not use client side javascript code.
I've been trying ... believe me
I need:
1. A grid with a drop down list filter using a datasource per current examples
2. yes / no radio buttons for filters on / off - Off is checked by default.
3. Grid set to allow filtering = false as default
5. click On - ajax update panel fires and shows the filters
5. click off - ajax update panel fires and hidesthe filters
I had this scenario working with a checkbox, and a custom filtering class for a drop down list I found on your forum.
Since I upgraded, to 2009 that custom class no longer filtered the grid. I think it had to do with fixing your double postback issue.
Could you please provide more information on the errors you received?
You could also try sending a runnable sample replicating them so we could debug it locally in order to find a resolution.
Greetings,
Iana
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
