473,385 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

ASCX without INamingContainer

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
10 1725
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
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rob Meade | last post by:
Hi all, I have just put together our organisations 'template' for our web applications and have created 7 .ascx files which when dropped into my template file work perfectly...however, I have a...
0
by: Alex Stevens | last post by:
Hi All, I have built a composite user web control and I've NOT implemented INamingContainer. It does implement IPostBackDataHandler to retrieve information entered into the controls when the...
3
by: rom | last post by:
I have an user control inside me aspx page and I want a button in the user control to call a sub in the aspx page. is it possible? I tried to several things like: 1. just call the...
2
by: Sam Samnah | last post by:
With INamingContainer ChildControl UniqueIDs or ClientIDs are Represented similar to the following: ParentControlID:childControlID Now my problem is the colon ":" used to sperate the Parent...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.