Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / June 2007

Tip: Looking for answers? Try searching our database.

include .ascx into a C# file

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
royend - 21 Jun 2007 11:19 GMT
How may I include a .ascx-file into my C#-file?
I have read somewhere that the usual include is no longer supported
for ASP.NET C#, but is there someway around this? The file to be
included is necessary for a lot of my C#-files, and by creating a
common file it will be much easier to edit only the one file.

Also, I am very keen to avoid using .dll-files, as this makes later
edits harder to accomodate.
Looking forward to your reply.

royend.
Peter Bromberg [C# MVP] - 21 Jun 2007 11:46 GMT
royend,
This is really an ASP.NET Group question, its not C# language group specific.

ASCX files are controls, and you have to add them to the ASPX markup portion
of the Page. You can drag the control onto the designer surface from the
Solution Explorer view.

You can also add an ascx file programmatically with the LoadControl method,
which sounds more like what you ar trying to do.
Peter
Signature

Site:  http://www.eggheadcafe.com
UnBlog:  http://petesbloggerama.blogspot.com
Short urls & more:    http://ittyurl.net

> How may I include a .ascx-file into my C#-file?
> I have read somewhere that the usual include is no longer supported
[quoted text clipped - 7 lines]
>
> royend.
Nicholas Paldino [.NET/C# MVP] - 21 Jun 2007 16:10 GMT
royend,

   Using DLL files doesn't make edits harder to accomidate, it's like any
other piece of code, you change it, compile it, and distribute it.  Also, if
it were allowed in the way you wish, including massive code documents on
multiple pages is going to have a detrimental effect on performance.

   You can use the App_Code directory to have standalone files which will
be compiled into dlls by the ASP.NET runtime, and all you have to do is
maintain the file.  Here is a link with more information:

http://dotnetjunkies.com/QuickStartv20/aspnet/doc/pages/code.aspx

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> How may I include a .ascx-file into my C#-file?
> I have read somewhere that the usual include is no longer supported
[quoted text clipped - 7 lines]
>
> royend.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.