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. Advertisements

  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. Advertisements

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:
    863
  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,339
    Lau Lei Cheong
    May 15, 2004
  3. Sebastian Paul
    Replies:
    1
    Views:
    655
    Sebastian Paul
    Oct 10, 2007
  4. Peter
    Replies:
    0
    Views:
    486
    Peter
    Sep 29, 2008
  5. Replies:
    1
    Views:
    586
    Teemu Keiski
    Jul 2, 2003
  6. daokfella

    Creating a control that does not render anything

    daokfella, Jun 11, 2007, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    168
    daokfella
    Jun 11, 2007
  7. Glenn Gillen
    Replies:
    0
    Views:
    491
    Glenn Gillen
    Nov 17, 2006
  8. Yaron Cohen
    Replies:
    0
    Views:
    438
    Yaron Cohen
    Nov 19, 2003
Loading...