Click here to Skip to main content
15,917,329 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi Friends,

I have HyperLinkField in the datagridview as 2nd row whose value is get from the database which is a URL, When i Click that URL it should redirect to that URL by updating a column in the database for that Row [counter as a column in the database whose value should be incremented by 1 when i click that URL]
Posted
Updated 27-Mar-12 15:06pm
v2

1 solution

You might want to add the below code when the row is binded:

C#
protected void yourGrid_RowDataBound(object sender, GridViewRowEventArgs e)
{
                HyperLink hlControl = new HyperLink();
                hlControl.Text = e.Row.Cells[2].Text; //Take back the text (let say you want it in cell of index 2)
                hlControl.NavigateUrl = "http://www.google.com";
                e.Row.Cells[2].Controls.Add(hlControl);//index 2 for the example
}
 
Share this answer
 

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