make gridview result clickable??

Posted by Rickeybglr under ASP.NET on 9/7/2012 | Points: 10 | Views : 1284 | Status : [Member] | Replies : 7
HI,
i have certain search records in gridview, i want tht if user bring mouse over it, it shud be clickable and on click it shud bring on to tht user home page. how can i achieve ths. i have only one home page. need to map all users to this single home page.




Responses

Posted by: Nithadeepak on: 9/7/2012 [Member] Bronze | Points: 25

Up
0
Down
protected void gdvList_RowDataBound(object sender, GridViewRowEventArgs e)

{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] = "this.style.cursor='pointer'";
e.Row.Attributes["onClick"] = "location.href='home.aspx'";
}
}


Nitha Deepak

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rickeybglr on: 9/7/2012 [Member] Starter | Points: 25

Up
0
Down
i have tried this ...but problem is tht its open home page of logged in user.
for ex:
i have log in into my account thn i search for my friends and i click on the username thn it shud redirect to his home page. but in ths case its redirectin to my home page

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nithadeepak on: 9/7/2012 [Member] Bronze | Points: 25

Up
0
Down
Pass the id of the user as querystring. If querystring is there load home page according to the id else load your home page

Nitha Deepak

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rickeybglr on: 9/7/2012 [Member] Starter | Points: 25

Up
0
Down
no this is not working ...

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rickeybglr on: 9/7/2012 [Member] Starter | Points: 25

Up
0
Down
Hi Nithadeepak,
thnks for replyn.. now i am able to make the rowa clicable and able to redirect to home page. but it goes to home page og logged in user.
i can pass id in query string, but i need to set this ID (primary key) to session Id of home page how can i do ths. if ths happens i thnk my problm might be solve

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vasanthmvp on: 9/7/2012 [Member] Starter | Points: 25

Up
0
Down
To make it a clickable, declare a link button in the gridview item template to the row which you want to set as a link.
Now use command argument, in which you can redirect location to, and also maintain a session id. To include any functionality you can use onrowcommand of grid view also.

Regards,

Awesome Coding !! :)

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nithadeepak on: 9/7/2012 [Member] Bronze | Points: 25

Up
0
Down
In page load of home page, check whether querysting is null or not. If query string is null do the coding according to the ID in session else do the coding according to the ID in querystring.

Nitha Deepak

Rickeybglr, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response