We help IT Professionals succeed at work.
Get Started

Pass a variable to hyperlink in code behind using visual basic.net

KavyaVS asked
Last Modified: 2012-05-12
I have to pass a variable to  hyperlink  at the start ofthe page. When we click this link it will go to the "Useful Tips Section" inside the same page:
                    dttable = GetDataFromDb()
                    Dim dv As dataview
                     dv = New DataView(dttable)
                    Dim UsefulTips As String  
                    UsefulTips = dv(0)("Information").ToString
                    dtRow = New TableRow()
                    dtCell = New TableCell()
                    dtCell.Text = <li><a href="Info.aspx#UsefulTips">UsefulTips</a></li>

I Created a link to the "Useful Tips Section" following way

                    dtRow = New TableRow()
                    dtCell = New TableCell()
                    link = New HyperLink()
                    UsefulTips = dv(0)("Information").ToString
                    link.Attributes.Add("name",UsefulTips )
                    link.Attributes.Add("href", "javascript:void(0)")

It is not working.Please let me know how to make it work when we pass the variable to hyperlink.
The link test is variable and and when we click the link it will go
 the section in a page using variable.
Watch Question
Most Valuable Expert 2012
Top Expert 2014
This problem has been solved!
Unlock 2 Answers and 16 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE