Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

So by luck I found that if you have a user control you want to reference called 'MyUserControl' you can create and instance of it through ASP.MyUserControl_ascx for pages that need it.

 

However I haven't figured out how to get the page - where they've hidden that class. If you're in the page your referencing, there it is, but outside of it you can't. You also can't put your code behind in a namespace because of the whole partial class thing...you'll get a compile error.

 

Does anyone know how you could create an instance of the code behind of page file? Or how to change the namespace - or even have one for a code behind - they don't seem to have one right now.

 

I have something that in the future I'm going to need this functionallity - I have a set of classes that basically have an association (in UML) between the two and I'd hate to redesign a functional set of pages because of this now 'missing' ability.

Posted
That's cool, but it just raises more questions. If they're going to be able to make an addition to do these things, why can't I manually do them now? I'm honestly disappointed at MS for taking that away. I'm sure it has to do with these partial classes and how they're used deep down to make the MSIL - but if a page should have a code behind, and that code behind is a class, then I should be able to make that class public and instantiate it anywhere in my project. On those same lines, I should be able to declare controls on my page publicaly accessible - not that I approve of that kind of design - but I should at least have the ability to.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...