How can i create a hyperlink to Grid view column, when i click this column it should open Word documentnt.Each Column row values does have seperate information.Can any one help me on this
You can use the <asp:HyperLinkField> to create a hyperlink column in gridview. It has an attribute DataNavigateUrlFields to which you can pass the unique value from your column and set the DataNavigateUrlFormatString to "SomePage.aspx?id={0}".
Inside SomePage.aspx, you can get the value from query string and write code that opens a word document based on the query string.
For how to open a word document in asp.net, please check the following threads in the forum:
pactools
Member
104 Points
362 Posts
Hyperlink column in Grid view
Nov 08, 2010 01:26 AM|LINK
How can i create a hyperlink to Grid view column, when i click this column it should open Word documentnt.Each Column row values does have seperate information.Can any one help me on this
ASP.NET3.5
riswadkarhar...
Contributor
2458 Points
561 Posts
Re: Hyperlink column in Grid view
Nov 08, 2010 02:25 AM|LINK
Hi,
You can use the <asp:HyperLinkField> to create a hyperlink column in gridview. It has an attribute DataNavigateUrlFields to which you can pass the unique value from your column and set the DataNavigateUrlFormatString to "SomePage.aspx?id={0}".
Inside SomePage.aspx, you can get the value from query string and write code that opens a word document based on the query string.
For how to open a word document in asp.net, please check the following threads in the forum:
http://forums.asp.net/t/1383889.aspx
http://forums.asp.net/t/917468.aspx?PageIndex=1
----------------------------------------------------------
Please mark as answer if the post helped you.
pactools
Member
104 Points
362 Posts
Re: Hyperlink column in Grid view
Nov 08, 2010 02:44 AM|LINK
Thanks Gentleman
sarathi125
Star
13599 Points
2691 Posts
Re: Hyperlink column in Grid view
Nov 08, 2010 02:48 AM|LINK
Hi,
Try like this
Protected
Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If (e.Row.RowType = DataControlRowType.DataRow) Then
Dim _item As Data.DataRowView = CType(e.Row.DataItem, Data.DataRowView)
Dim _myLink As HyperLink = CType(e.Row.FindControl("HyperLink1"), HyperLink)
If Not _myLink Is Nothing Then_myLink.NavigateUrl =
"javascript:pick('" + _item.Row("fieldName1").ToString() + "','" + _item.Row("fieldName2").ToString() + "','" + _item.Row("fieldName3").ToString() + "','" + _item.Row("fieldName4").ToString() + "');"
End If
End If
End Sub </div></div>Remember to click Mark as Answer on the post that helps to others.
My Blog :MyAspSnippets