web control from scratch

T

Tomk

I have a feeling I'm going about this all wrong....

In ASP 2.0 I used includes for common headers, footers, and menus on pages.
Since that concept is outdated I figured it would be a good spot for a
custom web control. I created a new Web Control Library and added a few
properties and then pasted my header HTML code in the render method using
output.Write. This accomplishes my main goal of replacing the include
concept form ASP 2.0 but what about events? My HTML code has links that I
need events for so I'm guessing I need to use the .NET Hyperlink control. I
can't seem to find any examples of web controls that don't start out from an
existing web control. What is the DOTNET way of doing this. I basically
need a custom navigation control that can fire events for each link pressed.
 
A

Alessandro Zifiglio

hi Tom, in my opinion what replaces includes that you had in classic asp are
user Controls. Coding user controls is so much easier + adding caching
capabilities etc.

However to answer you question, this article should put you in the right
track. As you will notice you have to manually add the event handlers etc ;P
http://msdn.microsoft.com/library/d...e/html/cpconpostbackusingjavascriptsample.asp

This would have never been a problem if you had used User Controls whereas
to custom controls, not that using cutom controls is wrong. Just harder ;)


So it would have been so much easier
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top