Reputation: 7672
Assume I have a page with a data grid bound to a data source. If I have 2 different clients accessing this page, is the data source different for each of them, or do they use the same data source?
If they're the same, what happens if a client applies a filter? The other clients sees that filter too? How to avoid this?
If they're not the same, and I have a big number of records, and data source mode is to DataSet, would this store 2 copies of same data on server? How do I solve such problems?
Upvotes: 1
Views: 156
Reputation: 46047
The SqlDataSource control is an instance class, so it would be recreated on each request. You may want to look into connection pooling though, so you can reuse database connections.
I don't think it's possible to make the control static, and I don't think you need to make the control static. If you want to reuse the dataset for all users who visit the page, I would look into caching the DataSet, or storing it in application state. I believe you can do this with the SqlDataSource using a mixture of the OnSelecting and OnSelected events.
Upvotes: 1
Reputation: 2801
They are separate unless you have made the Dataset static, then it will be shared across all instances of the page. I'm not sure what problem you are trying to solve exactly? Is there no database behind the dataset? Or are you worried about the memory consumption?
Upvotes: 0