I, fetched RollNo,StudName & City column on GridView control. RollNo column have HyperlinkField. What my requirement is, if I put my mouse pointer over any row of the gridview the Hyperlink hand should appear & I want to pass the RollNo which I
am using on Hyperlink field right now.
My code is working fine.. I set DataNavigateUrlField & DataNavigateUrlFormatString properties. Bu If I put my mouse pointer over the particular row the query string should be genarated.
RIght now I am putting the mouse pointer only on RollNo column
Ex: Details.aspx?RollNo={0} is working on RollNo column
Silverlight....
Member
431 Points
373 Posts
How to set hyperlink to whole row on GridView?
Jan 31, 2013 06:18 AM|LINK
Hi All,
I, fetched RollNo,StudName & City column on GridView control. RollNo column have HyperlinkField. What my requirement is, if I put my mouse pointer over any row of the gridview the Hyperlink hand should appear & I want to pass the RollNo which I am using on Hyperlink field right now.
Any suggestion?
Thanks
vijay_myl
Contributor
5070 Points
1068 Posts
Re: How to set hyperlink to whole row on GridView?
Jan 31, 2013 06:36 AM|LINK
hi you can use hyperlink or link button on gridview item template just the rollno on text like text='<#eval("rollno")>'
On hyperlink field on navigateurl set the redirect page as input
My .NET blog
Submit Article
kaushikmahet...
Contributor
3773 Points
896 Posts
Re: How to set hyperlink to whole row on GridView?
Jan 31, 2013 06:38 AM|LINK
same this type
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{ if (e.Row.RowType == DataControlRowType.DataRow) {
string LeadID = DataBinder.Eval(e.Row.DataItem, "LeadID").ToString();
string Location = ResolveUrl("~/Default.aspx") + "?LeadID=" + LeadID ;
e.Row.Attributes["onClick"] = string.Format("javascript:window.location='{0}';", Location);
e.Row.Style["cursor"] = "pointer";
}
}
Remember to click Mark as Answer on the post that helps to others.
Silverlight....
Member
431 Points
373 Posts
Re: How to set hyperlink to whole row on GridView?
Jan 31, 2013 06:40 AM|LINK
My code is working fine.. I set DataNavigateUrlField & DataNavigateUrlFormatString properties. Bu If I put my mouse pointer over the particular row the query string should be genarated.
RIght now I am putting the mouse pointer only on RollNo column
Ex: Details.aspx?RollNo={0} is working on RollNo column
Silverlight....
Member
431 Points
373 Posts
Re: How to set hyperlink to whole row on GridView?
Jan 31, 2013 07:19 AM|LINK
Gr8!! It solved my problem... Thanks!!!
Can we change the back color of the current row onMouseOver?
vinz
All-Star
128424 Points
18131 Posts
MVP
Re: How to set hyperlink to whole row on GridView?
Jan 31, 2013 01:10 PM|LINK
You can do something like this at RowCreated or RowDataBound event:
if (e.Row.RowType == DataControlRowType.DataRow) { string onmouseoverStyle = "this.style.backgroundColor='yellow'"; string onmouseoutStyle = "this.style.backgroundColor='white'"; e.Row.Attributes.Add("onmouseover", onmouseoverStyle); e.Row.Attributes.Add("onmouseout", onmouseoutStyle); }MessageBox Controls for WebForms | Blog | Twitter | Linkedin
Silverlight....
Member
431 Points
373 Posts
Re: How to set hyperlink to whole row on GridView?
Feb 01, 2013 03:45 AM|LINK
Thanks it works fine!!!