By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,276 Members | 1,303 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,276 IT Pros & Developers. It's quick & easy.

ASCX without INamingContainer

P: n/a
Is there any possibility to make an ASCX be loaded in an object that
does not implement INamingContainer, but mantain the funcionality of
events and etc?

I know i can`t do this using the current Page functions, but if I
implement another handler, or create another kind of UserControl that
doesn`t implement INamingContainer and a function that does what
LoadControl does... don`t know.

Just want to know if there is any way to do this.

Thanks.
Nov 19 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
You could always write a method that would just spit out HTML, or read
an HTML fragment from a file on disk and spit it into the page.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sat, 11 Dec 2004 16:01:01 -0200, Natan <nv********@mandic.com.br>
wrote:
Is there any possibility to make an ASCX be loaded in an object that
does not implement INamingContainer, but mantain the funcionality of
events and etc?

I know i can`t do this using the current Page functions, but if I
implement another handler, or create another kind of UserControl that
doesn`t implement INamingContainer and a function that does what
LoadControl does... don`t know.

Just want to know if there is any way to do this.

Thanks.


Nov 19 '05 #2

P: n/a
Scott Allen wrote:
You could always write a method that would just spit out HTML, or read
an HTML fragment from a file on disk and spit it into the page.


For that i could use #include, or even user controls....
What i need is an user control that doesn't extend INamingContainer. It
must be a compiled control to keep all the code, events and methods.
Nov 19 '05 #3

P: n/a
User controls in ASP.NET do implement INamingContainer, I thought you
were trying to avoid INamingContainer. What are you trying to
accomplish ultimately - avoid the client side ID munging?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 12 Dec 2004 08:09:20 -0200, Natan <nv***@mandic.com.br> wrote:
Scott Allen wrote:
You could always write a method that would just spit out HTML, or read
an HTML fragment from a file on disk and spit it into the page.


For that i could use #include, or even user controls....
What i need is an user control that doesn't extend INamingContainer. It
must be a compiled control to keep all the code, events and methods.


Nov 19 '05 #4

P: n/a
Scott Allen wrote:
I thought you were trying to avoid INamingContainer.
Yes. That's what i said.
What are you trying to accomplish ultimately - avoid the client side ID munging?


Exactly what i told before... A way to load a page or user control
inside another without the mess INamingContainer creates, but retaining
the functionality of a user control, events and code.

I have been searching throught mono's source code but it goes through
some internal classes. Probably .NET does the same to compile the control...

I wish there was a way to tell ASP.NET to do nothing with
INamingContainer...
Nov 19 '05 #5

P: n/a
I'm trying to be helpful, but you are not telling me what the "mess"
is that INamingContainer creates.

--
Scott
http://www.OdeToCode.com/blogs/scott/
On Sun, 12 Dec 2004 21:38:40 -0200, Natan <nv***@mandic.com.br> wrote:
Scott Allen wrote:
I thought you were trying to avoid INamingContainer.


Yes. That's what i said.
What are you trying to accomplish ultimately - avoid the client side ID munging?


Exactly what i told before... A way to load a page or user control
inside another without the mess INamingContainer creates, but retaining
the functionality of a user control, events and code.

I have been searching throught mono's source code but it goes through
some internal classes. Probably .NET does the same to compile the control...

I wish there was a way to tell ASP.NET to do nothing with
INamingContainer...


Nov 19 '05 #6

P: n/a
Scott Allen wrote:
I'm trying to be helpful, but you are not telling me what the "mess"
is that INamingContainer creates.


The problem for me is exactly what INamingContainer does... it keeps IDs
unique by prefixing them with the container name. And I know what it
does, but see, I don't want to load "user controls". For user controls,
it`s ok...

What i asked for is a way to load ASCX files to a control that doesn`t
implement INamingContainer. Even if i need to reimplement the ASP
parser... i just want to know what i could do to achieve this.
Nov 19 '05 #7

P: n/a
Perhaps you could derive from System.Web.UI.Control and implement
ITemplate, although I can't think of any examples on the web doing
this.

What you'll see happen in this case generally is that if there is
Javascript that needs to know the client ID, the script is formatted
server side eith the ClientID property of the control (or write the
ClientIDs into an array for javascript to reference).

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 13 Dec 2004 14:23:07 -0200, Natan <nv********@mandic.com.br>
wrote:
Scott Allen wrote:
I'm trying to be helpful, but you are not telling me what the "mess"
is that INamingContainer creates.


The problem for me is exactly what INamingContainer does... it keeps IDs
unique by prefixing them with the container name. And I know what it
does, but see, I don't want to load "user controls". For user controls,
it`s ok...

What i asked for is a way to load ASCX files to a control that doesn`t
implement INamingContainer. Even if i need to reimplement the ASP
parser... i just want to know what i could do to achieve this.


Nov 19 '05 #8

P: n/a
Scott Allen wrote:
Perhaps you could derive from System.Web.UI.Control and implement
ITemplate, although I can't think of any examples on the web doing
this.

What you'll see happen in this case generally is that if there is
Javascript that needs to know the client ID, the script is formatted
server side eith the ClientID property of the control (or write the
ClientIDs into an array for javascript to reference).


I repeat: i`m not trying to use UserControls... i`m trying to do some
experiences and see what i can do with asp.net. it`s not an usual use of
ascx files.

That`s the reason i said i could reimplement the whole asp.net parser if
i need. I just want to know what i can do to load an ascx file and make
it work, but not through user controls.
Nov 19 '05 #9

P: n/a
Natan:

I didn't mention user controls in the last post.

I did mention the Control class from the System.Web.UI namepace. This
is the base class defining the members common to all server side
ASP.NET controls, including (but not limited to) user controls, data
bound controls, literal controls, etc. In other words, if you want to
implement something new and interesting, this is as close to "starting
from scratch" as you'll get.

In a class derived from Control you can overide the Render method and
have complete control over the HTML it produces. You'd have to
implement your own Load method, as LoadControl is not a virtual
function, and the classes to parse and compile ASCX files are
internal.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Mon, 13 Dec 2004 18:02:30 -0200, Natan <nv********@mandic.com.br>
wrote:
Scott Allen wrote:
Perhaps you could derive from System.Web.UI.Control and implement
ITemplate, although I can't think of any examples on the web doing
this.

What you'll see happen in this case generally is that if there is
Javascript that needs to know the client ID, the script is formatted
server side eith the ClientID property of the control (or write the
ClientIDs into an array for javascript to reference).


I repeat: i`m not trying to use UserControls... i`m trying to do some
experiences and see what i can do with asp.net. it`s not an usual use of
ascx files.

That`s the reason i said i could reimplement the whole asp.net parser if
i need. I just want to know what i can do to load an ascx file and make
it work, but not through user controls.


Nov 19 '05 #10

P: n/a
Scott Allen wrote:
In a class derived from Control you can overide the Render method and
have complete control over the HTML it produces. You'd have to
implement your own Load method, as LoadControl is not a virtual
function, and the classes to parse and compile ASCX files are
internal.


thanks... that's what i imagined. =/
after seeing how asp pages are parsed and that there is a lot of
internal classes in System.Web, i think it will bee too complicated to
reimplement it.

I think i'll try Mono instead, so I can modify the necessary sources to
make this work.

Thanks.
Nov 19 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.