Need All Your Views on using Web User Controls.

K

Kiran

Hi,

I use a lot of web user controls for web development.

And I need all your views on this.

(1)Does the functionality(Logic part) of a web user control should be
included in the aspx page that uses the web user control using events.

If you are doing this way, you will be able to use the same user control
for different purposes(but you need to code in all the aspx pages that
uses the webuser control)

(2)Does the functionality(logic part) of a web user control should be
included in its code behind itself(.ascx.vb)

If you are doing this way, the way the user control works or behaves is
predefined and you can't change it for different aspx pages that uses
this user control(but no need to code in all the aspx pages that uses
this user control)

All of your views on this are welcome, I would like to know more about this.

Any help on this will be appreciated

Thanks
Kiran
 
H

Hans Kesting

Kiran said:
Hi,

I use a lot of web user controls for web development.

And I need all your views on this.

(1)Does the functionality(Logic part) of a web user control should be
included in the aspx page that uses the web user control using events.

If you are doing this way, you will be able to use the same user
control for different purposes(but you need to code in all the aspx
pages that uses the webuser control)

(2)Does the functionality(logic part) of a web user control should be
included in its code behind itself(.ascx.vb)

If you are doing this way, the way the user control works or behaves
is predefined and you can't change it for different aspx pages that
uses this user control(but no need to code in all the aspx pages that uses
this user control)

All of your views on this are welcome, I would like to know more
about this.
Any help on this will be appreciated

Thanks
Kiran

I think the second way is the usual way: the ascx should be self-contained.
Note: you can add properties and events to your ascx, so you can influence
the behaviour a bit. If you need radical changes in behaviour, then you would
need separate ascx'es.
If you want just a placeholder where the main page can write output to,
use a PlaceHolder, not an ascx-without-code.

An example:
if you want your pages to consist of header, main and footer ascx'es, then
you could have just one header and one footer, but you will need several
"main" versions, depending on the functionality required.
 
K

Kiran

Hans said:
I think the second way is the usual way: the ascx should be self-contained.
Note: you can add properties and events to your ascx, so you can influence
the behaviour a bit. If you need radical changes in behaviour, then you would
need separate ascx'es.
If you want just a placeholder where the main page can write output to,
use a PlaceHolder, not an ascx-without-code.

An example:
if you want your pages to consist of header, main and footer ascx'es, then
you could have just one header and one footer, but you will need several
"main" versions, depending on the functionality required.
Thanks Hans, I get the idea.
 

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,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top