.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

How to place hyperlink in GridView

Posted By: Ramesh     Posted Date: December 31, 2008    Points:2   Category :ASP.Net
Hi,
How to place Hyperlink inside GridView. I need to place Querystring also in the hyperlink column inside GridView In asp.net.

Data is coming from SQL Server and that is used to bind Query String which holds id

Please help me. Any help wold be appreciated.

Responses
Author: susant             
Posted Date: December 31, 2008     Points: 5   

Hi try this


Write in this way in soruce file of gridview..
--------------------------------------------------
<asp:GridView ID="GridView1" runat="server">
<Columns>
<ItemTemplate>
<a href="CourseContent.aspx?fullname=<%# Eval("fname") %>"> </a>
</ItemTemplate>
</Columns>
</asp:GridView>

.cs file
-----------------------
select the values from database

NOTE: here <%# Eval("fname") %>"> is the value "fname" from DB..
CourseContent.aspx is the .aspx file which it will take "fname" value....

Author: aamir             
Posted Date: January 01, 2009     Points: 5   

u can do as follow

<asp:GridView ID="GridView1" runat="server">
<Columns>
' one approach
<asp:HyperLinkField NavigateUrl='<%# Eval("url-field") %>' Text='<%# Eval("text-field") %>' />

' another approach
<asp:TemplateField>
<a href='<%# Eval("url-field") %>'><asp:Label ID="lblLink" runat="server" Text='<%# Eval("text-field") %>'></asp:Label></a>
</asp:TemplateField>
</Columns>
</asp:GridView>


Author: Athira Sreejith             
Posted Date: January 02, 2009     Points: 5   

Hi..

hypRemainingDate = new HyperLink();
// hypRemainingDate.CssClass = "boxtext_blue_Hyperlink";
hypRemainingDate.Text = FullRDate;
hypRemainingDate.NavigateUrl = "ExpensesStatement.aspx?mode=dashboard&&monthYear=" + monthname + "&&Date=" + GetRemainingDate[i] + "";
//gvr.Cells[2].Text = ExpenseDate;
gvr.Cells[2].Controls.Add(hypRemainingDate);



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend