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

    Create Link without using gridview column

    Hi ,Developers dood evening,

    i need to create hyperlink without using gridview column,
    The link is automatically created on if the databound depend upon how many records are stored in the database table.

    How help me to am done this task

    Yhankjs with
    Paul.S
  • #764355

    There is no direct way to add dynamic link in gridview, There are two ways. You can create HyperLinkField or add a Hyperlink in <asp:templatefield >
    see below snippet
    <Columns>
    <asp:HyperLinkField DataTextField="LeadID" DataNavigateUrlFields="LeadID" DataNavigateUrlFormatString="LeadInformation.aspx?LeadID={0}" Text="Lead ID" />
    <asp:BoundField DataField="DateTime" HeaderText="Date Updated" />
    <asp:TemplateField>
    <ItemTemplate>
    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Bind("LeadID") + Request.QueryString("type") %>'
    Text=""></asp:HyperLink>
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>


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

  • #764357
    Thanks for your quick reply Mr.Prasad

    Thanks with
    Paul.S

  • #764366
    Hi Paul,

    I guess you are expecting to show the Link when you move your cursor to particular row.

    If that is your requirement then you can achieve it by using AJAX Toolkit.

    There is a control named as HoverMenu in AJAX Controls, using this you can achieve your requirement.

    I wrote one article for the same, Refer below link for your reference "http://www.dotnetspider.com/resources/45272-HoverMenu-ASPnet-AJAX.aspx".

    Hope this will helpful to you...

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

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

  • #764375
    no no no sorry communication problem Mr.naveen

    I am expecting

    i have a VIEW link in my gridview.

    if i click the VIEW link na the particularattachment file which is stored on database instead of that column id will be open and display as a blank html page.

    thas all.

    Thanks with
    Paul.S

  • #764381
    Hi Paul,

    In that case as Prasad suggested you can use either Linkbutton or HyperLinkField, this will useful to accomplish your task.

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

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

  • #764396
    Hai Paul,
    There could be ways to do this:
    1. You can use the RowCreated event to create hyperlink or link button dynamically and add to the last column of the GridView.
    2. You can also use the RowDataBound event handler which will create the link and then attach the value(like you said the number to it from the database).
    Hope it will be helpful to you.

    Regards,
    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)
    pawansoftit@gmail.com


Sign In to post your comments