You must Sign In to post a response.
  • Category: ASP.NET

    Dynamically building hyperlink

    I have a asp.net app created in vs 2015 .on page load i get some data and bind to grid
    For eg my grid looks like
    Prod name. Q1 q2 q3
    A. 10 5 0
    B. 1. 33. 6
    Basically product details and quarter sales
    I want to add hyperlink to these columns ( q1 q2 q3)
    Only if ded is data ( not for zero and prod name )
    Also when usee clicks on each cell , i must be anle to get the header text of column. For eg. If i click 10 .i used retrieve q1 and product name in some variable
  • #765282
    Hi Devina,

    it's not a simple task to provide the solution in fraction of seconds, try to build from step wise, you can do it using server side coding. ?If you struck in any place let me know we will definitely help you to resolve the issue.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #765284
    To put hyperlink in gridview you need to put 'ItemTemplate' in gridview, see below aspx
    <asp:GridView ID="GridView1" HeaderStyle-BackColor="#3AC0F2" HeaderStyle-ForeColor="White"
    RowStyle-BackColor="#A1DCF2" AlternatingRowStyle-BackColor="White" AlternatingRowStyle-ForeColor="#000"
    runat="server" AutoGenerateColumns="false">
    <Columns>
    <asp:HyperLinkField DataTextField="Name" DataNavigateUrlFields="Id" DataNavigateUrlFormatString="~/Details.aspx?Id={0}"
    HeaderText="Name" ItemStyle-Width = "150" />
    <asp:BoundField DataField="Country" HeaderText="Country" ItemStyle-Width = "150" />
    </Columns>
    </asp:GridView>

    see below link for more help
    http://www.aspsnippets.com/Articles/HyperLinkField-HyperLink-in-ASPNet-GridView-Example.aspx

    Thanks
    Koolprasd2003
    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]


Sign In to post your comments