Adding public properties to a web control


show more Adding public properties to a web control provides you with in-depth training on Developer. Taught by David Gassner as part of the ASP.NET Essential Training show less
please wait ...

Adding public properties to a web control

In order to make your code more reusable, it's possible to declare public properties that are members of your user controls, and then set the values of these properties when you use the control in a page. For this demonstration, I'm going to use existing file HeaderWithProps.ascx. This is the same file that I was working on previously under the name Header.ascx. Notice that it has two ASP panel components, each resulting in a visual presentation. The first panel has the image, the second one the menu. In the one page that's left in this website that doesn't use the existing control, I still have the existing content, plus I also have an h1, a heading 1 that displays a heading at the top of the page. I would like to make that presentation a part of the control, but I would like to make the text within the heading 1 tags dynamic.

So I can change it when I use the control in a page. Here are the steps. The first part is to declare a public variable that's a member of t...

Adding public properties to a web control
Video duration: 4m 31s 6h 24m Beginner Updated Feb 13, 2013

Viewers:

Adding public properties to a web control provides you with in-depth training on Developer. Taught by David Gassner as part of the ASP.NET Essential Training

Subjects:
Developer Web
Software:
ASP.NET
Author:
please wait ...