Rod
Rod

Reputation: 15457

grid view user control uses session

I'm trying to build a grid view user control. The user control uses session to keep grid view's datasource alive.

Problem is when I put the user control on my page twice, the session gets mixed up because session name is hard-coded currently. What's the best way resolve this issue?

Upvotes: 0

Views: 51

Answers (2)

Kiran Hegde
Kiran Hegde

Reputation: 3681

The best way to save the control's data is to either use ViewState or ControlState. In that way you can isolate the data between different instances of the control in the same page.

Upvotes: 1

Sandeepkumar Gupta
Sandeepkumar Gupta

Reputation: 420

You may use user control id as key in session instead of hard coding key in session.

Regards, Sandeepkumar Gupta

Upvotes: 0

Related Questions