pavan kumar
pavan kumar

Reputation: 408

Can we add rows to datalist dynamically using a thread?

i have a stored procedure which is taking 10 seconds to pull 30 records from a table after long processing.Each datalist item has many controls within which are to be data bound while binding those 30 records to the datalist, which is also taking a bit long.

I want to know if we can assign this job to a thread??

Please help,thanks in advance!!

Upvotes: 0

Views: 113

Answers (1)

Mrinal Kamboj
Mrinal Kamboj

Reputation: 11478

Each datalist item has many controls within which are to be data bound while binding those 30 records to the datalist, which is also taking a bit long.

Binding a UI control, shall always be on the UI thread

I want to know if we can assign this job to a thread?

Simple answer is no for a UI control

Option for you would be an in memory data collection can be updated on a thread, but you need to make it thread safe either using a thread safe collection or a using a construct like lock

Final Data binding will always be on UI thread, else it will lead to exception

Upvotes: 1

Related Questions