Control from Cache does not render values.

Discussion in 'ASP .Net' started by BizWorld, Nov 16, 2007.

  1. BizWorld

    BizWorld Guest

    I am trying to cache a full DROP Down that can have lot of values. so
    i have 500 site users hitting a page in a second. i need to cache some
    controls that does not change quite often during the day. i am trying
    to test HTTRuntime.Cache object. in debug mode i can see the values on
    server side after i get the drop down from the cache but some how it
    does not show the values on generated html page. any idea what i am
    missing???


    If System.Web.HttpRuntime.Cache("DropDownList1") Is Nothing Then
    DropDownList1.Items.Add("1")
    DropDownList1.Items.Add("2")
    DropDownList1.Items.Add("3")
    System.Web.HttpRuntime.Cache("DropDownList1") =
    DropDownList1
    Else
    DropDownList1 =
    CType(System.Web.HttpRuntime.Cache("DropDownList1"), DropDownList)
    Response.Write(DropDownList1.Items.Count.ToString)
    End If
     
    BizWorld, Nov 16, 2007
    #1
    1. Advertising

  2. BizWorld

    bruce barker Guest

    you can not cache controls in session. this will lead to huge memory
    leaks, along with unexpected behavior.

    cache the data used to load the list.

    -- bruce (sqlwork.com)


    BizWorld wrote:
    > I am trying to cache a full DROP Down that can have lot of values. so
    > i have 500 site users hitting a page in a second. i need to cache some
    > controls that does not change quite often during the day. i am trying
    > to test HTTRuntime.Cache object. in debug mode i can see the values on
    > server side after i get the drop down from the cache but some how it
    > does not show the values on generated html page. any idea what i am
    > missing???
    >
    >
    > If System.Web.HttpRuntime.Cache("DropDownList1") Is Nothing Then
    > DropDownList1.Items.Add("1")
    > DropDownList1.Items.Add("2")
    > DropDownList1.Items.Add("3")
    > System.Web.HttpRuntime.Cache("DropDownList1") =
    > DropDownList1
    > Else
    > DropDownList1 =
    > CType(System.Web.HttpRuntime.Cache("DropDownList1"), DropDownList)
    > Response.Write(DropDownList1.Items.Count.ToString)
    > End If
     
    bruce barker, Nov 16, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    747
  2. Lau Lei Cheong

    Page.Render do not render complete page

    Lau Lei Cheong, May 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,118
    Lau Lei Cheong
    May 15, 2004
  3. Peter
    Replies:
    0
    Views:
    413
    Peter
    Sep 29, 2008
  4. Replies:
    1
    Views:
    405
    Teemu Keiski
    Jul 2, 2003
  5. Glenn Gillen
    Replies:
    0
    Views:
    320
    Glenn Gillen
    Nov 17, 2006
Loading...

Share This Page