passing multiple parameters in hyperlink in datagrid and underline the hyperlink

Posted on 2006-05-10
Last Modified: 2008-01-09
<asp:HyperLinkColumn DataNavigateUrlField="xno" DataNavigateUrlFormatString="Listpage.aspx?Action=Edit&id={0}"
                                                      DataTextField="xNo" HeaderText="Name"></asp:HyperLinkColumn>

I have to pass multiple parameters in hyperlink and also make the hyperlink underline. What is the syntax for the same?Is there any code required in code behind. I am using
Question by:PNKJ
    LVL 6

    Accepted Solution

    You must use column template instead of hyperlinkcolumn ans function for creating of hyperlink. Look at this:

                    <asp:TemplateColumn HeaderText="Chyby">
                            <asp:HyperLink Runat="server" NavigateUrl='<%#GetURL1(DataBinder.Eval(Container.DataItem, "chyby0"))%>' >
                                <%#DataBinder.Eval(Container.DataItem, "chyby0")%>

          Function GetURL1 (ByVal fldval As String) As String
          return "zsp_errseznam.aspx?zdroj=t04&chyba="+fldval+"&typchyby=&typzprac=&obdzprac="+"&rokzprac="+"&csml="+TextBox1.Text
         End Function

    LVL 12

    Expert Comment

    if you are referring multiple data fields to appear in asp:HyperLinkColumn, I think you will have to do it in your sql statement, "select 'action=edit&id=' + xNo + '&field2=' + field2 as Link1, xNo, field3 from table1"
    <asp:HyperLinkColumn DataNavigateUrlField="Link1" DataNavigateUrlFormatString="Listpage.aspx?{0}"
                                                 DataTextField="xNo" HeaderText="Name"></asp:HyperLinkColumn>

    If you are using 2.0, can try grid view instead.
          <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
                    <asp:HyperLinkField  DataNavigateUrlFields="name,age" DataNavigateUrlFormatString="Listpage.aspx?Action=Edit&id={0}&age={1}" DataTextField="name" HeaderText="Name"></asp:HyperLinkField>

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Suggested Solutions

    Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
    Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    how to add IIS SMTP to handle application/Scanner relays into office 365.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now