Here's the stack trace:
at Telerik.Web.UI.ListViewNullEnumerable.get_DataSourceCount()
at Telerik.Web.UI.RadListView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding)
at Telerik.Web.UI.RadListView.PerformDataBinding(IEnumerable data)
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect() at Telerik.Web.UI.RadListView.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind() at Telerik.Web.UI.RadListView.DataBind()
Here's my HTML code:
<
telerik:RadListView
ID
=
"RadListView1"
runat
=
"server"
Width
=
"100%"
AllowPaging
=
"true"
ItemPlaceholderID
=
"StylesHolder"
DataKeyNames
=
"StyleNumber"
OnPageIndexChanged
=
"RadListView1_PageIndexChanged"
>
<
LayoutTemplate
>
<
fieldset
style
=
"width: 100%; border: none;"
id
=
"FieldSet1"
>
<
asp:Panel
ID
=
"StylesHolder"
runat
=
"server"
>
</
asp:Panel
>
</
fieldset
>
</
LayoutTemplate
>
<
ItemTemplate
>
<
div
class
=
"grid_3 SearchResults_Container"
>
<
a
href
=
"#"
onclick
=
"DetailClick('<%# Eval("
StyleNumber") %>')">
<%-- This div is necessary in that 'relative' is required in a div before 'absolute' is used in next dic --%>
<
div
class
=
"SearchResults_ImageContainer"
>
<%-- This div forces image to be vertical-aligned at bottom, just above text, but centered. --%>
<
div
class
=
"SearchResults_ImageAlignment"
>
<%# GetStylePrimaryImage(Eval("StyleNumber") as string) %>
</
div
>
</
div
>
<%# Eval("StyleNumber") %><
br
/>
<%# Eval("ProductName") %>
</
a
>
</
div
>
</
ItemTemplate
>
</
telerik:RadListView
>
9 Answers, 1 is accepted
From the provided code snippet only it would be impossible for us to determine what is causing the issue on your end.
However, since you are not handling the OnNeedDataSource event, I could only assume that you are using Simple Data-Binding, can you please confirm that you are wrapping the DataBind method within the Page's Load event handler in !Page.IsPostback condition, as demonstrated in the example in the help article?
You could also try to use Advanced Data-Binding by handling only the OnNeedDataSource event of the RadListView control.
If you continue to experience problems with this, please open a regular support ticket with an attached sample, runnable project replicating the issue.
Regards,
Konstantin Dikov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

radListView.DataSource = GetDataTable(strCollectionID, strCollectionName, strDesignerID, strDesignerName, strProductTypeID, strProductTypeName, strRoomID, strRoomName, strSearch);
radListView.DataBind();
The GetDataTable returns a DataTable that is filled in from a SQL query. Even if the data table is empty the function runs ok, so I can't figure out what is causing this exception. It only happens occasionally when people browse the site. I have been unable to reproduce myself, either locally or on the live site. I am wondering if the problem might be caused by a user clicking something before the page is fully loaded, although they shouldn't be able to do that. Or maybe it happens when the web page doesn't fully load?
Do you have the exception message? Having the exception message in combination with the stack trace
could help us in isolating the cause of it. Additionally, please share any information that you have on the scenario when the error is observed by the users.
I am looking forward to your reply.
Regards,
Konstantin Dikov
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

ERROR=Cannot perform this operation when DataSource is not assigned.
STACK TRACE= at Telerik.Web.UI.ListViewNullEnumerable.get_DataSourceCount()
at Telerik.Web.UI.RadListView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding)
at Telerik.Web.UI.RadListView.PerformDataBinding(IEnumerable data)
at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
at Telerik.Web.UI.RadListView.PerformSelect()
at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
at Telerik.Web.UI.RadListView.DataBind()
at LookupStyles.BindListViewToDataSource(RadListView radListView, String strCollectionID, String strCollectionName, String strDesignerID, String strDesignerName, String strProductTypeID, String strProductTypeName, String strRoomID, String strRoomName, String strSearch) in c:\A-IISApps\VanguardFurniture.com\CFWebsite-v2.10\pages\LookupStyles.aspx.cs:line 441
at LookupStyles.UpdateSearchData() in c:\A-IISApps\VanguardFurniture.com\CFWebsite-v2.10\pages\LookupStyles.aspx.cs:line 662
at LookupStyles.RadListView1_PageIndexChanged(Object sender, RadListViewPageChangedEventArgs e) in c:\A-IISApps\VanguardFurniture.com\CFWebsite-v2.10\pages\LookupStyles.aspx.cs:line 641
at Telerik.Web.UI.RadListView.OnPageIndexChanged(RadListViewPageChangedEventArgs e)
at Telerik.Web.UI.RadListView.SetPageProperties(Int32 startRowIndex, Int32 maximumRows, Boolean databind)
at Telerik.Web.UI.RadListView.Telerik.Web.UI.IRadPageableItemContainer.SetPageProperties(Int32 startRowIndex, Int32 maximumRows, Boolean databind)
at Telerik.Web.UI.RadDataPager.ApplySettingsOnContainer(Int32 startRowIndex, Int32 pageSize, Boolean shouldBind)
at Telerik.Web.UI.RadDataPager.CallCommandToContainer(String commandName, String commandArgument)
at Telerik.Web.UI.RadDataPager.OnBubbleEvent(Object source, EventArgs args)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at Telerik.Web.UI.RadDataPagerFieldItem.OnBubbleEvent(Object source, EventArgs args)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Based on he information provided till now it is rather difficult to determine what exactly is causing the issue. Can you please elaborate if the DataBinding mechanism is used on each post back and if the RadListView has valid DataSource assigned on each post. Also this error may appear in case you are setting null ad DataSource for the RadLisdtView.
It will be best if you can open a regular support ticket and send us sample runnable application that demonstrates the issue. Thus we will be able to debug it locally and advise you further.
Regards,
Maria Ilieva
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Concerning the datasource: The RadListView is rebound depending on user interaction. It is on a screen that allows users to browse products. The RLV is rebound manually on postback if the user changes filters or goes to a new page in the results. Some other interactions which cause postback may not cause a rebind. But the code which does a rebind always assigns a data source, a DataTable, although it is possible that the table will be empty if there are no results.
Note that without having an option to replicate the issue and debug the application locally it would be rather difficult to isolate what exactly is causing this error.
You can post the whole page markup and related code behind here, so that we can research on them and see if any obvious reason can be isolated from the code.
Regards,
Maria Ilieva
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

If you succeed in reproducing the error in isolated project, you can open a regular support ticket and send the project to us. Thus we will be able to debug it locally and advise you further.
Regards,
Maria Ilieva
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.