Binding IEnumerable result set of a LINQ query
When binding IEnumerable result set of a LINQ query to a nested grid getting ERROR:
NotSupportedException : The data source does not support server-side data paging;
Details are below
Code:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
IList<Products> listpdt = (IList < Products >) Session["Product"];
if (e.Row.RowType == DataControlRowType.DataRow)
{
var pdt = from p in listpdt
where p.ProductName == âAppleâ
select p;
GridView gdv = (GridView)e.Row.FindControl("GridView2");
gdv.DataSource = pdt;
gdv.DataBind();
}
}
Suppose returns 4 result set of type IEnumerable and I am binding to Gridview which is nested in another Gridview.
STAKE TRACE
----------------------
at System.Web.UI.DataSourceView.RaiseUnsupportedCapab ilityError(DataSourceCapabilities capability)
at System.Web.UI.DataSourceSelectArguments.RaiseUnsup portedCapabilitiesError(DataSourceView view)
at System.Web.UI.WebControls.ReadOnlyDataSourceView.E xecuteSelect(DataSourceSelectArguments arguments)
at System.Web.UI.DataSourceView.Select(DataSourceSele ctArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.GridView.CreateChildCont rols(IEnumerable dataSource, Boolean dataBinding)
at System.Web.UI.WebControls.CompositeDataBoundContro l.PerformDataBinding(IEnumerable data)
at System.Web.UI.WebControls.GridView.PerformDataBind ing(IEnumerable data)
at System.Web.UI.WebControls.DataBoundControl.OnDataS ourceViewSelectCallback(IEnumerable data)
at System.Web.UI.DataSourceView.Select(DataSourceSele ctArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.Perform Select()
at System.Web.UI.WebControls.BaseDataBoundControl.Dat aBind()
at System.Web.UI.WebControls.GridView.DataBind()
at CollectionClass.GridView1_RowDataBound(Object sender, GridViewRowEventArgs e) in c:\Documents and Settings\A037034\My Documents\Visual Studio 2008\WebSites\WebSite2\CollectionClass.aspx.cs:lin e 88
"I'm a great believer in luck and I find the harder I work, the more I have of it "
|