Visual Web Developer Help

Soldato
Joined
8 Oct 2005
Posts
4,184
Location
Midlands, UK
Hi,

I'm making a web application whereby users create an account and log in to view their own personalized content. However, I'm having trouble isolating the current logged in user so I can display their own content (that is stored in an sql database - Userid is the primary key and is linked to the built ASPNETDB database as I have used the creatuser component). How exactly do I go about doing this using VWD?

Thanks
 
That isn't what he's after, at least that's not what i've gathered from his post..

Can you elaborate a little more? Are you trying to get some DATA that user has stored?

If so, you need to create an SQL query first to retrieve it.

I'm trying to create a simple page so a user can manage their account. E.g. they sign up, log in and have a profile page whereby they edit their details. Displaying the data is very easy, isolating the current user is proving a little more tricky (the person logged in). I have also used the built in ASPNETDB database so i imagine i'll have to add a relationship between the user id in aspnet_users and my created table.

EDIT: managed to get this working using

Code:
        MembershipUser currentUser = Membership.GetUser();
        Guid currentUserId = (Guid)currentUser.ProviderUserKey;
        e.Command.Parameters["@UserId"].Value = currentUserId;

in the UserProfileDataSource_Selecting event. :)


I have come across another problem.

In dreamweaver i could display master/detail pages easily. E.g. have say Master.asp with a list of say book titles. Each title would have a link to bookdetail.asp with detail for the clicked book. I can do this on the same webpage where you sync up two grid view controls, but i cant find anything explaing how to have the detail element on a seperate page.

Any help much appreciated.

Thanks
 
Last edited:
EDIT: have solved the above using request.querystring. It was easier in dreamweaver imo, but still.

I have come across another smaller problem. I want to display the current logged in user role on their profile page. Have tried a variety of ways, including:

Code:
 someLabel.Text = "Your role is: " + User.Identity.Role();

and

Code:
[FONT=Verdana][SIZE=2][/SIZE]CurrentUser = Membership.GetUser(HttpContext.Current.User.Identity.Name).ToString()
        CurrentCompany = Roles.GetRolesForUser(CurrentUser).ToString()

        Label1.Text = CurrentCompany[/FONT][SIZE=2][/SIZE]

and

Code:
[SIZE=2]someLabel.Text = [/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2].Join([/SIZE][SIZE=2][COLOR=#a31515]","[/COLOR][/SIZE][SIZE=2], Roles.GetRolesForUser())[/SIZE]

and a variety of methods using

Code:
[COLOR=teal]HttpContext[/COLOR].Current.User.Identity

Im lost, can anyone help me?
 
Just one final thing is now stopping me finishing. I just need a basic search box. I have searched the web and can only find some very involved examples that i don't understand. Can someone suggest a good resource?

EDIT: nm, got it now.


Thanks
 
Last edited:
Hi again.

Have come across a problem that has me stumped unfortunately. I'm trying to make a simple form to allow user data input into a database. Firstly let me show you my tables:

Code:
[B] Book
[/B]*BookID
Book Title

[B]Cust
[/B]*CustID

[B]Book_Cust
[/B]*BookID
*CustID

Now, using built in asp.net 2.0 controls i can insert data into the same table fine by adding a 'DataSourceName.Insert() ' to the click event of my form button.

The problem comes when i try to insert data into the Book_Cust table. In my form I want the user to select the book title from a drop down menu, rather than have to type a valid BookID.

I'm a little confused how about the INSERT query query I'd use here. I'm thinking some sort of WHERE clause may be needed.

In the form, the CustID field would be hidden as I have this linked to the aspnet database. So the form would only contain a single drop down field and a button saying "buy book" for example.

I have found many tutorials explaining how to insert data into a table using values from that table, but nothing for my problem.

Thanks
 
Apologies for bumping this thread but the internet seems to be void of information for my problem. Does anyone kind sole have an idea how I could approach this?
 
Back
Top Bottom