or
Hello,
I'm attempting to use the RadGrid filtering with the RadFilter demo to recreate the example myself but unfortunately the filter doesn't apply at all when I attempt to apply it. Here's a copy of the aspx page:
<form id="PageForm" runat="server"> <telerik:RadScriptManager runat="server" ID="RadScriptManager1" /> <telerik:RadAjaxManager runat="server" ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadFilter1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadFilter1"></telerik:AjaxUpdatedControl> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl> <telerik:AjaxUpdatedControl ControlID="SqlDataSource1" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1"></telerik:RadAjaxLoadingPanel> <div class="filterDiv"> <telerik:RadFilter runat="server" ID="RadFilter1" FilterContainerID="RadGrid1" ShowApplyButton="false"></telerik:RadFilter> </div> <telerik:RadGrid runat="server" ID="RadGrid1" AutoGenerateColumns="false" DataSourceID="SqlDataSource1" AllowPaging="true" AllowSorting="true" AllowFilteringByColumn="true" OnItemCommand="RadGrid1_ItemCommand"> <MasterTableView IsFilterItemExpanded="false" CommandItemDisplay="Top"> <CommandItemTemplate> <telerik:RadToolBar runat="server" ID="RadToolBar1" OnButtonClick="RadToolBar1_ButtonClick"> <Items> <telerik:RadToolBarButton Text="Apply filter" CommandName="FilterRadGrid" /> </Items> </telerik:RadToolBar> </CommandItemTemplate> <Columns> <telerik:GridNumericColumn DataField="PreferenceID" HeaderText="PreferenceID" /> <telerik:GridNumericColumn DataField="UserID" HeaderText="UserID" DataType="System.Int32" /> <telerik:GridNumericColumn DataField="SiteID" HeaderText="SiteID" DataType="System.Int32" /> <telerik:GridBoundColumn DataField="Value" HeaderText="Value" /> </Columns> </MasterTableView> </telerik:RadGrid> <asp:SqlDataSource runat="server" ID="SqlDataSource1" SelectCommand="Select PreferenceID, UserID, SiteID, Value FROM iWeb..TAB_Preference" ConnectionString="<%$ ConnectionStrings:iWeb %>" /> </form>Here's the code-behind page:
Protected Sub RadGrid1_ItemCommand(ByVal source As Object, ByVal e As GridCommandEventArgs) If e.CommandName = "FilterRadGrid" Then RadFilter1.FireApplyCommand() End IfEnd SubProtected Sub RadToolBar1_ButtonClick(ByVal source As Object, ByVal e As RadToolBarEventArgs)End SubHere's a link to the example I'm using:
http://demos.telerik.com/aspnet-ajax/filter/examples/integration/defaultvb.aspx?product=filter
Any help would be greatly appreciated.
private void BuildResultPanel() { _mppUserListView = new Telerik.Web.UI.RadListView() { ID = "MPPUserResultList", RegisterWithScriptManager = true, AllowPaging = true }; var mainDiv = new HtmlGenericControl("Div"); mainDiv.Attributes.Add("style", "overflow:hidden;border:1px solid black;padding:5px;margin-top:15px"); this.Controls.Add(mainDiv); mainDiv.Controls.Add(_mppUserListView); _mppUserListView.LayoutTemplate = new PhotoUploadLayoutTemplate(); var photoUploadResultItemTemplate = new PhotoUploadResultItemTemplate(); var container = new Control(); photoUploadResultItemTemplate.InstantiateIn(container); var s = RenderControl(container); //_mppUserListView.ItemTemplate = photoUploadResultItemTemplate; //_mppUserListView.ItemPlaceholderID = "items"; _mppUserListView.ClientSettings.DataBinding.ItemTemplate = s; _mppUserListView.ClientSettings.DataBinding.ItemPlaceHolderID = "items"; _mppUserListView.ClientSettings.DataBinding.DataService.Location = "/_layouts/services/MPPusersPhotoBioUpload/MPPUsers.ashx"; _mppUserListView.ClientSettings.DataBinding.DataService.DataPath = "GetMPPUsers"; if (MIAjax != null) MIAjax.AjaxSettings.AddAjaxSetting(_mppUserListView, _mppUserListView, MIAjaxLoader); }public void InstantiateIn(Control container) { var dataPager = new RadDataPager { PagedControlID = "MPPUserResultList", ID = "MPPUserResultList_pagerTop", PageSize = 20 }; dataPager.Fields.Add(new RadDataPagerButtonField() { FieldType = PagerButtonFieldType.FirstPrev }); dataPager.Fields.Add(new RadDataPagerButtonField() { FieldType = PagerButtonFieldType.Numeric, PageButtonCount = 5 }); dataPager.Fields.Add(new RadDataPagerButtonField() { FieldType = PagerButtonFieldType.NextLast }); container.Controls.Add(dataPager);...}<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> <script type="text/javascript"> function OnClientNodeClicked(sender, args) { var currNode = args.get_item(); var childNodes = currNode.get_childItems(); var nodeCount = currNode.get_childItems().length; if (nodeCount > 0) { var isChecked = currNode.get_selected(); UpdateAllChildren(currNode, childNodes, nodeCount, isChecked); } } function UpdateAllChildren(currNode, nodes, nodecount, checked) { var i; for (i = 0; i < nodecount; i++) { if (checked) { nodes[i].set_selected(true); } else { nodes[i].set_selected(false); } } } </script></telerik:RadCodeBlock><telerik:RadTreeList ID="rtlBusinessUnit" runat="server" DataKeyNames="Business_Unit_ID" ClientSettings-AllowPostBackOnItemClick="false" OnNeedDataSource="rtlBusinessUnit_OnNeedDataSource" ParentDataKeyNames="ParentBUID" OnItemCreated="rtlBusinessUnit_OnItemCreated" OnItemDataBound="rtlBusinessUnit_OnItemDataBound" AutoGenerateColumns="false" AllowMultiItemSelection="true"> <Columns> <telerik:TreeListSelectColumn HeaderStyle-Width="38px" UniqueName="BussinessUnitCheckboxes"> </telerik:TreeListSelectColumn> <telerik:TreeListBoundColumn DataField="Business_Unit_ID" HeaderText="Business_Unit_ID" Visible="false" UniqueName="Business_Unit_ID" /> <telerik:TreeListBoundColumn DataField="LegalName" HeaderText="Name" UniqueName="LegalName" /> <telerik:TreeListBoundColumn DataField="Business_Unit_ID" HeaderText="Business_Unit_ID" Visible="false" UniqueName="Business_Unit_ID" HeaderStyle-Width="80px" /> </Columns> <ClientSettings> <ClientEvents OnItemSelected="OnClientNodeClicked" OnItemDeselected="OnClientNodeClicked" /> <Selecting AllowItemSelection="true" /> <Scrolling AllowScroll="true" UseStaticHeaders="true" SaveScrollPosition="true" ScrollHeight="300" /> </ClientSettings> </telerik:RadTreeList>| <telerik:RadComboBox |
| ID="ListingState" |
| TabIndex="4" |
| EnableEmbeddedSkins="true" |
| Skin="Black" |
| runat="server" |
| Width="250px" |
| MarkFirstMatch="true" |
| Height="200px" |
| ToolTip="Select your state/province." |
| OnClientSelectedIndexChanging="LoadCities" |
| OnItemsRequested="ListingState_ItemsRequested" |
| OnClientItemsRequested="ItemsLoaded" |
| > |
| </telerik:RadComboBox> |
protected void SelectAll_CheckedChangedEvent(object sender, EventArgs e) { CheckBox SelectAll = sender as CheckBox; foreach (GridItem item in grdOnDSelection.Items) { if (SelectAll.Checked == true) { CheckBox chk = (CheckBox)item.Cells[2].FindControl("chkOnDSelection"); chk.Checked = true; RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent"); txtDsicountPercent.Enabled = true; } else { RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent"); txtDsicountPercent.Enabled = false; grdOnDSelection.Rebind(); } } }protected void chkOnDSelection_checkedChangedEvent(object sender, EventArgs e) {((sender as CheckBox).NamingContainer as GridItem).Selected = (sender as CheckBox).Checked; CheckBox chk = sender as CheckBox; GridItem item = chk.NamingContainer as GridItem; if (chk.Checked && item.Cells[7].FindControl("txtDsicountPercent") is RadNumericTextBox) { RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent"); txtDsicountPercent.Enabled = true; } if (chk.Checked == false && item.Cells[7].FindControl("txtDsicountPercent") is RadNumericTextBox) { RadNumericTextBox txtDsicountPercent = (RadNumericTextBox)item.Cells[7].FindControl("txtDsicountPercent"); txtDsicountPercent.Enabled = false; //grdOnDSelection.Rebind();//all chkboxes will be deselected }}