Hello,
I get an error when I choose an item of a drop down list, that rebinds a grid. With some items of the dropdownlist works fine but with others stop working and I get this error on the browser console:
If I disable AJAX, it works fine, but with AJAX problems happens. I also attach the error that I get from the console.
I also put here part of my code:
This is the index change function:
NeedDataSource:
Page Load:
AjaxSettings:
Any idea of why this is happening?
I would appreciate any idea for fixing this problem.
Thank you very much,
Jon
I get an error when I choose an item of a drop down list, that rebinds a grid. With some items of the dropdownlist works fine but with others stop working and I get this error on the browser console:
If I disable AJAX, it works fine, but with AJAX problems happens. I also attach the error that I get from the console.
I also put here part of my code:
This is the index change function:
protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e) { ProductRepository productRP = new ProductRepository(); Filters filters = new Filters(); filters.Add(new Filter("Supplier.Id", SupplierId)); if (ddlCategory.SelectedValue != "All") filters.Add(new Filter("Product.ProductCategory.Id", ddlCategory.SelectedValue.ToString())); IList<SupplierProduct> supplierProducts = productRP.LoadList<SupplierProduct>(filters); RadGrid1.DataSource = supplierProducts; // System.Threading.Thread.Sleep(3000); RadGrid1.Rebind(); }
NeedDataSource:
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { ProductRepository productRP = new ProductRepository(); Filters filters = new Filters(); filters.Add(new Filter("Supplier.Id", SupplierId)); if(ddlCategory.SelectedValue != "All") filters.Add(new Filter("Product.ProductCategory.Id", ddlCategory.SelectedValue.ToString())); // filters.Add(new Filter("Active","true")); // filters.Add(new Filter("Product.Active", "true")); IList<SupplierProduct> supProducts = productRP.LoadList<SupplierProduct>(filters); RadGrid1.DataSource = supProducts; }Page Load:
protected void Page_Load(object sender, EventArgs e) { SupplierId = Session["SupplierId"].ToString(); if (String.IsNullOrEmpty(SupplierId)) { Response.Redirect("login.aspx"); } if (!Page.IsPostBack){ ProductRepository productRP = new ProductRepository(); Filters filters = new Filters(); filters.Add(new Filter("Supplier.Id", SupplierId)); IList<SupplierProductCategory> SupplierProductCategories = productRP.LoadList<SupplierProductCategory>(filters, "ProductCategory.Description"); IList<ProductCategory> ProductCategories = new List<ProductCategory>(); foreach (SupplierProductCategory supplierProductCategory in SupplierProductCategories) { ProductCategories.Add(supplierProductCategory.ProductCategory); } ddlCategory.DataSource = ProductCategories; ddlCategory.DataBind(); } }AjaxSettings:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"
ClientEvents-OnRequestStart="mngRequestStarted"
meta:resourcekey="RadAjaxManager1Resource1">
<AjaxSettings> <telerik:AjaxSetting AjaxControlID="RadGrid1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> <telerik:AjaxUpdatedControl ControlID="RadInputManager1" /> <telerik:AjaxUpdatedControl ControlID="Label1" /> <telerik:AjaxUpdatedControl ControlID="RadMenu1" /> <telerik:AjaxUpdatedControl ControlID="ddlCategory" /> <telerik:AjaxUpdatedControl ControlID="ddlLanguage" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="RadAjaxManager1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> <telerik:AjaxUpdatedControl ControlID="RadInputManager1" /> <telerik:AjaxUpdatedControl ControlID="Label1" /> <telerik:AjaxUpdatedControl ControlID="RadMenu1" /> <telerik:AjaxUpdatedControl ControlID="ddlCategory" /> <telerik:AjaxUpdatedControl ControlID="ddlLanguage" /> </UpdatedControls> </telerik:AjaxSetting> <%-- ----excel export----------%> <telerik:AjaxSetting AjaxControlID="mngBtnExcel"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" /> <telerik:AjaxUpdatedControl ControlID="mngBtnExcel" /> </UpdatedControls> </telerik:AjaxSetting> <%-- ----context menu----------%> <telerik:AjaxSetting AjaxControlID="RadMenu1"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> <telerik:AjaxUpdatedControl ControlID="RadMenu1" /> </UpdatedControls> </telerik:AjaxSetting> <telerik:AjaxSetting AjaxControlID="ddlCategory"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" /> <telerik:AjaxUpdatedControl ControlID="ddlCategory" /> </UpdatedControls> </telerik:AjaxSetting>
...Any idea of why this is happening?
I would appreciate any idea for fixing this problem.
Thank you very much,
Jon