How to add Eval for hyperlink in gridview in

In this post we will discuss how we can add Eval property into hyperlink field in gridview in Asp.Net.

New to Office 365 SharePoint Online? Get Office 365 Enterprise E3 Subscription & Try out all the features

In this schnerio, we will see how a user can navigate to a different page with a query string parameter. In the below code it will see a list of usernames which are binding from the database. Then whenever a user clicks on a particular username, then it will navigate to a UserDetails page with taking UserID as a querystring parameter.

Full Code:

<asp:TemplateField HeaderText=”Name”>

<asp:HyperLink ID=”hylMachineNum” runat=”server” NavigateUrl='<%# “~/UserDetails.aspx?UserID=” + Eval(“UserID”)%>’ Text='<%#Eval(“UserName”)%>’>



Here the Text value is coming from the Eval property by the following syntax.


And the NavigateURL property is coming from the below property:

NavigateUrl='<%# “~/UserDetails.aspx?UserID=” + Eval(“UserID”)%>’

Also, you can check out some posts on:

– How to directly save Excel File into SharePoint Online Document Library

– Unable to add workflow actions in SharePoint 2010 designer workflow

– Fix width of the master page in SharePoint 2010

Check out Best Alternative to InfoPath -> Try Now


(Installation & Features)

About Bijay Kumar

I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site

View all posts by Bijay Kumar →