Solved

asp.net webform

Posted on 2008-10-29
4
361 Views
Last Modified: 2013-11-26
I am developing a asp.net website using visual basic 2008 I am using html not server controls to navigate from one webform to another. I want to somehow capture the event clicking of the html link so I can determine what webform is opening so that I can save the appropiate session variables. The problem is using html links to navigate I have no idea how to accomplish that. So any help on trying to figure this out would greatly be appreciated
0
Comment
Question by:lothos123452000
  • 2
  • 2
4 Comments
 
LVL 2

Accepted Solution

by:
smokingspaceman earned 500 total points
ID: 22837746
You mean you use HTML <a> tags for navigation?
If so make change the runat attribute of the <a> tag to server.
<a id="link" href="sdfs.aspx" runat="server">link</a>

And you can add an event handler to the on click event of that control;
    Protected Sub link_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles link.ServerClick
0
 

Author Comment

by:lothos123452000
ID: 22838063
What if my html looks like the following

<li><a href="ContactUs.aspx" runat="server">Contact Us</a></li>

I have a space between Contact and Us it is not working plus I get the following error

"Handles clause requires a WithEvents variable defined in the containing type or one of its base types."
0
 

Author Closing Comment

by:lothos123452000
ID: 31511529
Never mind about my second post your suggestion worked great! Thanks for the help.
0
 
LVL 2

Expert Comment

by:smokingspaceman
ID: 22838073
The problem is you dont have an Id for your <a> tag.
It should be
<li><a id="contactUs" href="ContactUs.aspx" runat="server">Contact Us</a></li>
and
Protected Sub link_click(ByVal sender As Object, ByVal e As System.EventArgs) Handles contactUs.ServerClick
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LINQ - C# to VB convertion 12 46
Unable to upgrade to .Net 4.6.2 on Server 2012r2 2 42
Entity Framework 7 30
Not seen Link button 5 14
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

912 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

17 Experts available now in Live!

Get 1:1 Help Now