locked
Reset the declarative cache SqlDataSource with "click-button-event" RRS feed

  • Question

  • User1899595498 posted

    I have SqlDataSource1 control with declarative infinite CacheDuration setup in MyFirstPage.aspx.

    I want MyButton control in other page MySecondPage.apx can reset the cache SqlDataSource1 to load the updated database whenever I click MyButton control.

    Again, SqlDataSource1 will reset the cache only when I click MyButton control in MySecondPage.apx.

    My two questions are:

    1. Is it possible to implement my goal using Visual Studio 2008 with VB code and SQL 2005 version? Please answer Yes or No.

    2. If yes, please advise the idea and main VB code to implement this goal.

    Thanks.

    Tuesday, November 22, 2011 5:45 PM

Answers

  • User3866881 posted

    1. Is it possible to implement my goal using Visual Studio 2008 with VB code and SQL 2005 version? Please answer Yes or No.

    I think so—— Yes。

    2. If yes, please advise the idea and main VB code to implement this goal.

    【In WebForm1.aspx】

    Plz write a new public property to open the SqlDataSource to the public——something like this:

    Public Property SqlDataSourceReference
      Get
               Return your private sqldatasource
      End Get
    End Property

    But when you jump to WebForm2.aspx, you must use something like Server.Transfer("WebForm2.aspx").

    【In the WebForm2.aspx】

    ((WebForm1)Context.Handler).SqlDataSourceReference.CatchDurasion=XXX

    Hope this helps!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, November 23, 2011 9:55 PM