locked
Store ObjectDataSource query parameters RRS feed

  • Question

  • User115974766 posted

    I have a search screen that is using an ObjectDataSource to display search results in a gridview.   I'm using control parameters to pass parameter values to the select method.  I have a requirement to save the last ObjectDataSource query.  The user would like to see the results of the last search query if they happen to return to the search screen again.  Is is possible to store the last ObjectDataSource  query in a session variable and execute the same query again on page load?  If so, would I have to store each individual control parameter value?

    Friday, March 18, 2016 2:49 PM

Answers

  • User-986267747 posted

    Hi Eric V,

    Is is possible to store the last ObjectDataSource  query in a session variable and execute the same query again on page load?  If so, would I have to store each individual control parameter value?

    In my experience, you could save these query conditions to a session variable, then we could set the select parameters for the ObjectDataSource , then we could call the select method and show the last query result in the gridview.

    If so, would I have to store each individual control parameter value?

    You could create a class object that contains each individual control parameter, we could use the class object  to store each individual control parameter value and save the class object in the session.

    http://forums.asp.net/t/1694890.aspx?Can+we+store+class+objects+in+sessions

    Best Regards,

    Klein zhang

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 21, 2016 6:53 AM

All replies

  • User465171450 posted

    Use session/cookie to store the values that you are passing to it through control parameters instead.

    Saturday, March 19, 2016 5:02 PM
  • User-986267747 posted

    Hi Eric V,

    Is is possible to store the last ObjectDataSource  query in a session variable and execute the same query again on page load?  If so, would I have to store each individual control parameter value?

    In my experience, you could save these query conditions to a session variable, then we could set the select parameters for the ObjectDataSource , then we could call the select method and show the last query result in the gridview.

    If so, would I have to store each individual control parameter value?

    You could create a class object that contains each individual control parameter, we could use the class object  to store each individual control parameter value and save the class object in the session.

    http://forums.asp.net/t/1694890.aspx?Can+we+store+class+objects+in+sessions

    Best Regards,

    Klein zhang

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 21, 2016 6:53 AM