Connecting Tech Pros Worldwide Help | Site Map

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

Luke Dalessandro
Guest
 
Posts: n/a
#1: Nov 18 '05
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.


Cowboy (Gregory A. Beamer) - MVP
Guest
 
Posts: n/a
#2: Nov 18 '05

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


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:
[color=blue]
> 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.
>
>
>[/color]
Luke Dalessandro
Guest
 
Posts: n/a
#3: Nov 18 '05

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


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" <NoSpamMgbworld@comcast.netNoSpamM> wrote
in message news:73E2E024-8182-4CF8-A967-BBBB101B8464@microsoft.com...[color=blue]
> 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:
>[color=green]
>> 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.
>>
>>
>>[/color][/color]


Closed Thread