Calling inline (ascx) methods from codebehind file using partial classes

I am using .net 2.0. I would like to place one of my C # methods in an embedded server script inside my ascx file because I need to update it a lot when I design. This way I don't have to compile my big project every time.

I would like to call a method from my code behind a file. I use this by inserting a virtual stub method in the codebehind file and overriding it in the ascx file. Now, since I started using partial classes, I expected to be able to just call the method directly. It's impossible?

thanks

0


a source to share


2 answers


Unfortunately, I don't think this is possible. At design time, the partial class (* .designer.cs) basically only contains your controls. The class that actually contains the code from the script block is also generated by ASP.NET, but inherits from your main class.



Cm. http://msdn.microsoft.com/en-us/library/ms178138.aspx for more information.

0


a source


I don't understand your motive ... Isn't it as easy to change the page code as the .ascx file? In any case, ASP.NET is going to either compile them dynamically when the file is accessed, or forces you to rebuild, depending on the type of project.



0


a source







All Articles