Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have home page .. where i show welcome message through label ...

that print different user name based on their login.


the problem i got when i click on userimage from differnt page.. it print same username.. on differnt id when it redirect to homepage by querystring. plz help trough example


my tbluser table contain:
id
username
userimage
Posted
Comments
[no name] 30-Aug-10 11:27am    
Your question is not very clear. Please restate it and understand that we are not working on your project so need the details.
Sandesh M Patil 30-Aug-10 11:55am    
Provide code to elaborate or visit http://www.codeproject.com/Forums/1580229/Hindi.aspx Hidi forum to help u

Suppose your home page is Home.aspx

And, you have another page UserList.aspx where you have the images of the users.

When you click on the image of a user, you can redirect to the Home.aspx with a QueryString parameter as follows:

Response.Redirect("Home.aspx?UserId=" + userId");


In the Page_Load() method of Home.aspx.cs you read the UserId from the Query String and then retrieve the user from the database using the UserId and show user name. For example:

C#
int UserId= 0;
if(Request.Params["UserId"] != null)
{
    UserId = Convert.ToInt32(Request.Params["UserId"]);
}
if(UserId> 0)
{
    User user = GetUserFromDB(UserId)
    PopulateUI(user);
}
 
Share this answer
 
v2
Comments
balongi 31-Aug-10 9:54am    
thanks....
Sounds like some flaw in your logic to find/pass the username when you click on the user-image.

It would be hard to be specific without seeing the code but looks like the way you are accessing the user id makes it common for all, like using an application object to store it!

If you are using querystring to pick the username/userimage based on ID, then you need to be sure that you are retriving them everytime you are trying to.
 
Share this answer
 
Comments
balongi 31-Aug-10 9:55am    
:) thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900