Introducing Custom Controls
page 6 of 6
by . .
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 29709/ 109

Additional Methods

AddAttribute

This method takes in the name of the attribute and the value of it. In the above example I passed in border for the name and 1 for the value.

AddStyleAttribute

This method takes in the name of the style property and the value of it. Using this method, it properly formats your style attribute without you having to mess around with it and probably get a syntax error along the way.

RenderBeginTag/RenderEndTag

These two methods start rendering and stop rendering the tag specified by RenderBeginTag. Using these methods take some adjustment, but in the end they present properly formatted code. They also allow you to make the code more dynamic (easier than having a lot of ' "something" & varname & "something" ') with ease.

Summary

This article has barely scratched the surface of custom controls, in future articles, I will show you more about advanced custom controls and other things that you can do with them.


View Entire Article

User Comments

Title: Custom vs. User control BLUNDER – user control CAN be referenced in the code.   
Name: Igor Kikena
Date: 2005-03-14 3:53:38 PM
Comment:
Implementing page can reference user control exactly the same way as custom control, otherwise there is really little use for them. And Yes, it does not create user control variable when you drag and drop it on the page, contrary to custom control. So leave your mouse alone and strike the damn keyboard and enjoy user controls in the code behind.

Igor Kikena
Title: Ok..Its a good Topic   
Name: Esha
Date: 2005-03-08 4:47:14 AM
Comment:
I will be better if u give an sample code for building custom control and embedding it in asp webform page
Title: airo   
Name: airo
Date: 2005-01-13 10:13:47 PM
Comment:
Excellent topic and well explained.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2018 ASPAlliance.com  |  Page Processed at 2018-07-22 10:25:29 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search