Hi, i'm working on a template framework for .NET 1.1 that is to work pretty much like MasterPages in 2.0. It's almost done, but I decided to make templating also available for user controls, i.e. an ascx control could be templated. But when working on it, I stumbled upon a little problem that I havent found any good solution to yet. The problem is that a user control dont have any property for it's virtual path. Like when i use an ascx file in a page (/control/mycontrol.ascx), i would like it's class to be aware of it's path. I havent been able to find any property that hold that value. The closest thing I found was the property Control.TemplateSourceDirectory
and because ascx files derive from UserControl
that in turn derives from TemplateControl
, the value of TemplateSoureDirectory
will be the directory holding the ascx file. But that wont give me the filename of it. One possible solution I tought of is to use the name of the top class filename_ascx
that is created when ASP.NET compiles the files. But it dont look like a consistent solution, so I wonder if anyone here has any better ideas about this? Propapbly some simple property or method I've missed as usual :doh:
Rouzbeh_d
Posts
-
Path of a loaded UserControl (ascx) -
MasterPages in .NET 2.0 and control namingHi, Thanx for that information...i've somehow managed to bypass all that is to learn on Control naming. But I see now why these names are generated. :)
-
MasterPages in .NET 2.0 and control namingI've tried out the express version of Visual Web Developer in order to find out a few details on the new MasterPage framework in .NET 2.0. To my surprice, it found a little problem in the naming of servercontrols that I use in my contentpages. For example if I use a WebControls.Button, I declare it in the aspx file as: Now in regular cases, the control would render itself as an tag on the final document, having it's id parameter set to the id of the Button control. But when using the MasterPages all server controls that produce some sort of html-tag that would be interesting to manipulate on client-side gets an addition to their id. Like . And this produces some problem in some cases. I dont know if it's just because of .NET 2.0 being beta right now or if that's the way it should be in order for the framework to route the events to the right place on postbacks. I hope someone here can give me some more insight into this or point me in the right direction on this.