Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

basic custom control

Status
Not open for further replies.

gorgor

Programmer
Aug 15, 2002
164
US
This is very basic. I've been using .NET Windows Forms for awhile and now am trying out ASP.NET. My background is in HTML, JScript, and Perl. I'm trying to create my own custom control (not a user control since a user control is a whole form). I am using ASP.net with Visual Studio.NET and C#. I added a regular C# class to my project and hand-modified it so it derives from System.Web.UI.WebControls.LinkButton.

Code:
using System;
using System.Web.UI.WebControls;

namespace Rollover
{
	/// <summary>
	/// Summary description for RolloverButton
	/// </summary>
	public class RolloverButton : System.Web.UI.WebControls.LinkButton
	{
		public RolloverButton()
		{
			this.Text = "testing 1 2 3";
		}
	}
}

Now all I want to do is put it on my page WebForm1.aspx so that I can play around with it. This is very basic, but I haven't found much on the web on this topic.

I'm not too thrilled about modifying the WebForm1.aspx (html) code. I went to .NET so that I could get away from HTML and JScript. I've had enough of it! I'd like to avoid hand-modifying the generated HTML as much as possible. Is there a way I can do all the design (or at least MOST of it) in the WebForm1.aspx.cs version of the file with methods and properties? Obviously I'll have to tweak the html and jscript at the end of design to get it "just right", but all the examples I've found so far makes it look to me like I'm still going to have to do alot of HTML and JScript (even with the 'power' of ASP.net).

Am I on the wrong track with my 'custom control'? I'm trying to approach it like it's a Windows Control and maybe that's wrong.

Any help will be greatly appreciated. Thanks in advance!
 
Thanks for the link. Have you come across any examples or how-to's on creating custom controls where most of the work is done on the server? In C# perhaps? Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top