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:
int UserId= 0;
if(Request.Params["UserId"] != null)
{
UserId = Convert.ToInt32(Request.Params["UserId"]);
}
if(UserId> 0)
{
User user = GetUserFromDB(UserId)
PopulateUI(user);
}