Allow users to view profiles

 I'm working with visual studio 2005 and i'm working on a social network but i'm stuck.
I am trying to make it so other users can view other users profile, i was told i could do it through a query string, i have a page called profile.aspx and this is what i did.

I dragged a gridview onto the show_members.aspx page along with a SQLdatasource
I configured the gridview to the ASPNET.MDF database.
I than created a hyperlink field into the gridview so users can click the username and view their profile

http://s72.photobucket.com/albums/i195/tazangelpa/Jasons%20Photos/?action=view&current=addfield.jpg 

now when i view it in the browser i log in and when i click a username for example wolf it takes me to the profile.aspx?uid=wolf page and if i click another user it will take me to (for example) "profile.aspx?uid=snuggly" page but still ends up being my username.

I don't know much about databases and how i would configure something like that.

Please help, in desperate need of it.

Thank you Big Smile 


 

0
wolf25
7/15/2007 11:44:05 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

7 Replies
283 Views

Similar Articles

[PageSpeed] 6

 Dear Friend,

It seems like you have to extract the value from the QueryString.

You can use the following code:

Page_Load

{

    // run the following when the page is NOT posting back 

    if(Request.QueryString["uid"] != null)

{

    string userId = Request.QueryString["uid"] as String;

    // Now you can pass the userId to the database and load the user's profile.  


HighOnCoding
Wanna get high!
0
azamsharp
7/16/2007 12:45:11 AM

 Maybe i'm doing something wrong...here's what i did step by step and it might be alittle more useful.

  • i created a page called view_members.aspx
  • dragged a gridview and sqldatasource onto the view_members.aspx page
  • in the gridview tasks i chose configure datasource
  • i chose the ASPNETDB connection string
  • in the dropdownlist i chose "vw_aspnet_membershipusers"
  • i than selected Email and UserName from the columns
  • I clicked next than Tested the Query with all registered users showing
  • After i clicked finish in the tasks list i chose Add new column
  • In the field type i chose hyperlink field (as shown  in  the link in my last post)

I also created a page called profile.aspx with a username control.

when i run the application and click a username link the url looks like something like this (if i click username for wolf, profile.aspx?uid=wolf with my username displaying on the profile.aspx page, now if i click another username for example tyler i get this url, profile.aspx?uid=tyler but still get my username on the page.

I'm trying to make it so when someone clicks on a username from gridview i created it will take them to their profile page, i don't know if the query string is setup properly or if there's more i need to add...sorry for the long question just realy racking my brains here  

0
wolf25
7/16/2007 2:51:56 AM

 Ok here's what you gotta do:

 Create a new hyperlink column. type the name like "View Profile"

Now instead of clicking on "Specify URL"

hit the "Get URL From data field"

 
under URL String format type in the name of the page you want it to goto and put a question mark and go ={0}

 
for example

 
/details.aspx?uid={0}

 


HOPE IT HELPS! 

0
IanMundy
7/16/2007 4:17:46 AM

 Ok i did that and i am assuming i'm getting closer.

When i click on any username i get the following error

HTTP Error 404 - Not Found.
Version Information: ASP.NET Development Server 8.0.0.0

 

 

0
wolf25
7/16/2007 1:19:57 PM

 What you're looking for is in this video

http://www.asp.net/learn/videos/view.aspx?tabid=63&id=47

It's the part where he's linking each Customer...

 Hopefully this will solve your problem!

 
Cheers,

Ian
 

0
IanMundy
7/16/2007 6:53:45 PM

 Thank you very much it worked :-)

I've been trying to figure this thing out for months now, and the funny thing is, is i've watched theese videos over and over again.

It goes to show that it doesn't matter how many times you've watched them, there's gonna be a point in time when you're gonna need to go back to them 

0
wolf25
7/17/2007 1:12:02 AM

 Glad to have helped, good luck for the rest of your application!
 

0
IanMundy
7/17/2007 6:24:25 PM
Reply: