Subkeys and CookieParameter

Last post 12-19-2006 5:39 PM by scott_scott. 3 replies.

Sort Posts:

  • Subkeys and CookieParameter

    11-02-2006, 10:52 PM
    • Member
      70 point Member
    • mwinner
    • Member since 09-04-2006, 7:46 PM
    • Posts 14

    Does anybody know how to retrieve a Subkey from a cookie via asp:CookieParameter?

    Also, I'm using an ObjectDataSource, and want to take the value from the above cookie, send it to the function, manipulate it, and send it back into that cookie.

    Any ideas? Thanks for any help!

  • Re: Subkeys and CookieParameter

    11-05-2006, 9:17 PM
    Answer
    • Contributor
      4,635 point Contributor
    • Gordon-Freeman
    • Member since 07-17-2006, 8:19 AM
    • SH, PRC
    • Posts 909

    Hi~ In my experience, asp:CookieParameter only support single value cookie...

    So you need to do it in code..

    For example, you need this value in select, you can:

    1. ObjectDataSource.SelectParameters["XXX"].DefaultValue = Request.Cookies["XXX"].....

    2. Trap the ODS's Selecting event, and set there e.InputParameters["XXX"] = Request.Cookies["XXX"].....

    你好! Just FYI o_O
  • Re: Subkeys and CookieParameter

    12-19-2006, 5:20 PM
    • Member
      4 point Member
    • scott_scott
    • Member since 12-19-2006, 4:58 PM
    • Posts 2

    I am having the same issue with the having multiple keys and the cookieparamter.  Your solution seems to be a very good idea, and I am trying to implement it.  Where would I set this default value?

    I tried to set this in the page load event, but I am getting "Object reference not set to an instance of an object."  Intellisense picked up all the parts, so my datasource is intact and available.  I removed the cookie value to narrow down the problem, so I was using this:

    MyDateSource.SelectParameters("UserID").DefaultValue = "1"

    However, I am still getting the same error.

    Any suggestions?

     

    P.S.  Nice user picture, Gordon Freeman is the best.

     

     



     

  • Re: Subkeys and CookieParameter

    12-19-2006, 5:39 PM
    • Member
      4 point Member
    • scott_scott
    • Member since 12-19-2006, 4:58 PM
    • Posts 2

    Sorry, stupid mistake on my part.  When I removed the cookieparameter, I forgot to put in the standard parameter tag.

     

    <

    SelectParameters>

    <asp:Parameter Name="UserID" Type="Int32" />

    </SelectParameters>
Page 1 of 1 (4 items)