passing multiple parameters in hyperlink in datagrid and underline the hyperlink

Posted on 2006-05-10
Medium Priority
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 vb.net
Question by:PNKJ

Accepted Solution

the_paab earned 1000 total points
ID: 16655534
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

ID: 16655727
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 asp.net 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>

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

578 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