accessing session and viewstate from custom web controls

Discussion in 'ASP .Net Web Controls' started by Agustin Sanchez, Jul 16, 2003.

  1. I know it is possible to use Session and Viewstate objects from a Web User
    Control, as it's almost the same as a standard aspx page. I'd like to know
    if the same functionality is available from Custom Web Controls.

    Thanks in advance.

    Agustin Sanchez
     
    Agustin Sanchez, Jul 16, 2003
    #1
    1. Advertising

  2. Agustin Sanchez

    Teemu Keiski Guest

    The ViewState as with web user controls but your custom control just derives
    from System.Web.UI.Control or perhaps System.Web.UI.WebControls.WebControl.
    The control has it's own ViewState property (of type System.Web.UI.StateBag)
    when this is fullfilled.

    For the session you need to access via controls Context property. That is

    Context.Session["key"]="value";

    and so on

    --
    Teemu Keiski
    MCP,Designer/Developer
    Mansoft tietotekniikka Oy
    http://www.mansoft.fi

    AspInsiders Member, www.aspinsiders.com
    ASP.NET Forums Moderator, www.asp.net
    AspAlliance Columnist, www.aspalliance.com


    "Agustin Sanchez" <> kirjoitti viestissä
    news:...
    > I know it is possible to use Session and Viewstate objects from a Web User
    > Control, as it's almost the same as a standard aspx page. I'd like to know
    > if the same functionality is available from Custom Web Controls.
    >
    > Thanks in advance.
    >
    > Agustin Sanchez
    >
    >
     
    Teemu Keiski, Jul 16, 2003
    #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. Axel Dahmen
    Replies:
    1
    Views:
    502
    Teemu Keiski
    Nov 12, 2003
  2. rodchar
    Replies:
    0
    Views:
    397
    rodchar
    Nov 26, 2007
  3. Replies:
    1
    Views:
    288
    bruce barker
    Feb 19, 2008
  4. Moldy

    Accessing Properties of Custom Controls child Controls

    Moldy, Sep 4, 2003, in forum: ASP .Net Building Controls
    Replies:
    8
    Views:
    229
    Moldy
    Sep 5, 2003
  5. Moldy
    Replies:
    8
    Views:
    253
    Moldy
    Sep 5, 2003
Loading...

Share This Page