Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
The IListSource does not contain any data sources.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The IListSource does not contain any data sources.

Source Error:

Line 80:         da.Fill(ds);
Line 81:         GridView1.DataSource = ds;
Line 82:         GridView1.DataBind();
Line 83: 
Line 84:         //SqlDataSource SqlDataSource1 = new SqlDataSource();


Source File: c:\bliss\www\www_view.aspx.cs    Line: 82

Stack Trace:

[HttpException (0x80004005): The IListSource does not contain any data sources.]
   System.Web.UI.DataSourceHelper.GetResolvedDataSource(Object dataSource, String dataMember) +393
   System.Web.UI.WebControls.ReadOnlyDataSource.System.Web.UI.IDataSource.GetView(String viewName) +38
   System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView() +226
   System.Web.UI.WebControls.DataBoundControl.GetData() +4
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +57
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
   System.Web.UI.WebControls.GridView.DataBind() +4
   www_www_view.btn_search_Click(Object sender, EventArgs e) in c:\bliss\www\www_view.aspx.cs:82
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746
Posted
Updated 9-Jul-12 4:21am
v2
Comments
[no name] 9-Jul-12 7:48am    
And?
ZurdoDev 9-Jul-12 8:21am    
You must give the IListSource a DataSource.
Sandeep Mewara 9-Jul-12 10:22am    
Use the "Improve question" link to edit your question and provide better information.

1 solution

Possibly you can try this

C#
GridView1.DataSource = ds.Tables[0].DefaultView;


Or

C#
GridView1.DataSource = ds.Tables["<tablename>"].DefaultView;</tablename>


Since the Datasource property of the Gridview is not able to find any datasources you are getting the error.And before binding please try and check if the dataset has tables or not.If it has tables,point to the specific table for the DataSource of the grid and then bind it.

Try this It should work
 
Share this answer
 
Comments
[no name] 2-May-13 5:56am    
nice

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900