I'm using asp:ListView control to bind data to it by a DataSet table. When i use normal asp.net programming (1 thread per application) it's binding OK. I can use it with ObjectDataSource, DataSourceID + ListView1.DataBind(); syntax and another option with
codebehind ListView1.DataSource = ds.Table[0]; ListView1.DataBind();. These both options work and bind the data.
When I use ThreadPool to have asynchronous multithreading the listview doesn't bind. There's no any errors, the code is absolutely the same, the data is there, and even when i'm debugging the code flows goes normally and passes through each bound control
in the aspx page like (<asp:Label runat="server" ID="lblDurationTimeReturn" Text='<%#Eval("DurationTimeReturn")%>' />) inside ItemTemplate in the asp:ListView.
When i have a ThreadPool i tried both databinding methods - 1) DataSourceID, 2) DataSource from codebehind but still the same results described above.
The code doesn't go into the EmptyDataTemplate of the ListView. The webpage area in the ListView doesn't show anything (white screen).
Please, point out any suggestions you can get on your mind. Thanks in advance.
I found the problem. It was my mistake. I just didn't correctly DataBind the ListView. It tried to bind it in the wrong place, in the wrong thread. After the fix, it's binding and displaying records with both ways, through DatSource property and through
DataSourceID declarative syntax. I just wanted to confirm, there's not a problem with databinding when using ThreadPool and asynchronous mutli-threading.
Marked as answer by Digitborn.com on Mar 18, 2012 08:25 AM
Digitborn.co...
Member
684 Points
450 Posts
ThreadPool and DataBind ListView
Mar 17, 2012 09:53 AM|LINK
Hello,
I'm using asp:ListView control to bind data to it by a DataSet table. When i use normal asp.net programming (1 thread per application) it's binding OK. I can use it with ObjectDataSource, DataSourceID + ListView1.DataBind(); syntax and another option with codebehind ListView1.DataSource = ds.Table[0]; ListView1.DataBind();. These both options work and bind the data.
When I use ThreadPool to have asynchronous multithreading the listview doesn't bind. There's no any errors, the code is absolutely the same, the data is there, and even when i'm debugging the code flows goes normally and passes through each bound control in the aspx page like (<asp:Label runat="server" ID="lblDurationTimeReturn" Text='<%#Eval("DurationTimeReturn")%>' />) inside ItemTemplate in the asp:ListView.
When i have a ThreadPool i tried both databinding methods - 1) DataSourceID, 2) DataSource from codebehind but still the same results described above.
The code doesn't go into the EmptyDataTemplate of the ListView. The webpage area in the ListView doesn't show anything (white screen).
Please, point out any suggestions you can get on your mind. Thanks in advance.
Digitborn.co...
Member
684 Points
450 Posts
Re: ThreadPool and DataBind ListView
Mar 18, 2012 08:25 AM|LINK
I found the problem. It was my mistake. I just didn't correctly DataBind the ListView. It tried to bind it in the wrong place, in the wrong thread. After the fix, it's binding and displaying records with both ways, through DatSource property and through DataSourceID declarative syntax. I just wanted to confirm, there's not a problem with databinding when using ThreadPool and asynchronous mutli-threading.