ProtectedSub rlv_NeedDataSource(ByVal sender AsObject, ByVal e As Telerik.Web.UI.RadListViewNeedDataSourceEventArgs) Handles rlv.NeedDataSource
Dim sqlDR As SqlDataReader
sqlDR = ObjectTest.List()
rlv.DataSource = sqlDR
2 Answers, 1 is accepted
answered on 11 Jun 2010, 04:06 PM
Can you please verify that neither the DataReader nor the underlining DataConnection is closed while RadListView is databinding. The best place to close the connection and reader in this case will be inside RadListView DataBound event. You may take a look at this online demo for a runnable sample.
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Thanks, That was the problem. My ObjectTest.List() returns a sqldatareader. This .List() function exists within a business class. Because of this setup, I guess the sqldatareader the .List() function returns gets closed after the list control binds to it? and binding that to a radListView doesn't allow me to close the sqldatareader
within the list's databind event instead.
I had to change the code so that instead of binding it to the object class's .List function, I had to create a different sqldatareader, loading it , etc. on the same code level as where I bind the list to the sqldatareader, so I have direct access to this reader in the radListView's databind event to close the sqldatareader. For cleaniless of code, I'd rather not do this. I'm not sure why the radListview has an issue with binding to my object class's .List function when the radGrid doesn't. So I ended up using a radGrid for what I need instead of the radListView.