ASP.NET 2.0 How-To: Bind datasource parameter to UserID?

Discussion in 'ASP .Net' started by Luke Dalessandro, Sep 28, 2004.

  1. I am trying to develop a quick Shopping cart for ASP.NET 2.0. I have added a
    CartItems table to the AspNetDB access database, that contaings CartItems
    keyed off of the aspney_Users.UserId key (the automatically generated
    primary key for the table).

    I want to bind the current user's CartItems to a GridView, which should be
    really easy. The problem is that I need the UserID as a parameter for my
    AccessDataSource. The parameters that can be automatically accessed can come
    from any of the:

    Control
    QueryString
    Session
    Cookie
    Form
    Profile

    groups.

    I can't seem to find UserId exposed anywhere. The profile exposes UserName,
    which I use to programatically grab the UserId for logged in users, but the
    Cart needs to work for anonymous users...

    Any help would be appreciated. I don't really want to write an
    ObjectDataSource, although I will if that is the only way. It seems like
    there should be some way to automatically bind to UserId though.
     
    Luke Dalessandro, Sep 28, 2004
    #1
    1. Advertising

  2. Look at the help file for "Understanding ASP.NET Profile Properties". You can
    add any properties you want. That is where I would start.

    ---

    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    ***************************
    Think Outside the Box!
    ***************************


    "Luke Dalessandro" wrote:

    > I am trying to develop a quick Shopping cart for ASP.NET 2.0. I have added a
    > CartItems table to the AspNetDB access database, that contaings CartItems
    > keyed off of the aspney_Users.UserId key (the automatically generated
    > primary key for the table).
    >
    > I want to bind the current user's CartItems to a GridView, which should be
    > really easy. The problem is that I need the UserID as a parameter for my
    > AccessDataSource. The parameters that can be automatically accessed can come
    > from any of the:
    >
    > Control
    > QueryString
    > Session
    > Cookie
    > Form
    > Profile
    >
    > groups.
    >
    > I can't seem to find UserId exposed anywhere. The profile exposes UserName,
    > which I use to programatically grab the UserId for logged in users, but the
    > Cart needs to work for anonymous users...
    >
    > Any help would be appreciated. I don't really want to write an
    > ObjectDataSource, although I will if that is the only way. It seems like
    > there should be some way to automatically bind to UserId though.
    >
    >
    >
     
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN, Sep 28, 2004
    #2
    1. Advertising

  3. Thanks Cowboy,

    This sort-of helps.

    I know how to add properties and interact with the Profile object, and to
    enable anonymous users.

    I also know that I can write Profile values in the Application
    OnAcquireRequestState event.

    I guess that what I don't know how to do is to access the ASP.NET-assigned
    UserID for an anonymous user.

    Luke

    "Cowboy (Gregory A. Beamer) - MVP" <> wrote
    in message news:...
    > Look at the help file for "Understanding ASP.NET Profile Properties". You
    > can
    > add any properties you want. That is where I would start.
    >
    > ---
    >
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    >
    > ***************************
    > Think Outside the Box!
    > ***************************
    >
    >
    > "Luke Dalessandro" wrote:
    >
    >> I am trying to develop a quick Shopping cart for ASP.NET 2.0. I have
    >> added a
    >> CartItems table to the AspNetDB access database, that contaings CartItems
    >> keyed off of the aspney_Users.UserId key (the automatically generated
    >> primary key for the table).
    >>
    >> I want to bind the current user's CartItems to a GridView, which should
    >> be
    >> really easy. The problem is that I need the UserID as a parameter for my
    >> AccessDataSource. The parameters that can be automatically accessed can
    >> come
    >> from any of the:
    >>
    >> Control
    >> QueryString
    >> Session
    >> Cookie
    >> Form
    >> Profile
    >>
    >> groups.
    >>
    >> I can't seem to find UserId exposed anywhere. The profile exposes
    >> UserName,
    >> which I use to programatically grab the UserId for logged in users, but
    >> the
    >> Cart needs to work for anonymous users...
    >>
    >> Any help would be appreciated. I don't really want to write an
    >> ObjectDataSource, although I will if that is the only way. It seems like
    >> there should be some way to automatically bind to UserId though.
    >>
    >>
    >>
     
    Luke Dalessandro, Sep 28, 2004
    #3
    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. Hardy Wang
    Replies:
    1
    Views:
    3,011
    Nicholas Paldino [.NET/C# MVP]
    Dec 5, 2005
  2. mazdotnet
    Replies:
    0
    Views:
    705
    mazdotnet
    Sep 12, 2007
  3. bogdan
    Replies:
    0
    Views:
    357
    bogdan
    Apr 9, 2008
  4. bisrael

    ASP.NET Newbie radiobuttonlist bind datasource

    bisrael, Feb 27, 2005, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    241
    Wilco Bauwer
    Feb 27, 2005
  5. bisrael

    Newbie asp:wizard bind datasource

    bisrael, Mar 4, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    135
    bisrael
    Mar 4, 2005
Loading...

Share This Page