Re: INCLUDE
From: Sorin Dolha [MCSD .NET] (sdolha_at_hotmail.com)
Date: 03/02/04
- Next message: v-jetan_at_online.microsoft.com: "Re: Any Tool that can explore DLL"
- Previous message: The Poster Formerly Known as Kline Sphere: "Re: Variables in catch(...) clauses?"
- In reply to: Dmitri Shvetsov: "Re: INCLUDE"
- Next in thread: Dmitri Shvetsov: "Re: INCLUDE"
- Reply: Dmitri Shvetsov: "Re: INCLUDE"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 2 Mar 2004 09:48:24 +0200
Dmitri,
Why don't you create a new class (let's call it MyPage) derived from Page, overload the OnLoad() method in MyPage, and then change the base type for every of your web pages' classes to MyPage instead of Page.
This technique is a very common technique for adding common functionality to web pages (it's almost like the master template page concept which will be available in ASP .NET "Whidbey").
--
Sorin Dolha [MCAD, MCSD .NET]
"Dmitri Shvetsov" <dshvetsov@cox.net> wrote in message news:fWU0c.12379$id3.3055@fed1read01...
Not so easy. I need to do the same steps during ON_LOAD for every asp page.
That's why I need to insert the same strings to compile them in different
classes. If I could use an external file and define a static variables etc.,
it would be a big difference.
Dmitri.
"C# Learner" <csharp@learner.here> wrote in message
news:e6HWFVBAEHA.3256@TK2MSFTNGP09.phx.gbl...
> Dmitri Shvetsov wrote:
>
> > Hi All,
> >
> > Does somebody know how can I include an external file into my C# source
> > file?
> >
> > I need to insert the same strings (about 5-10) into about 75 different
> > files, probably I will need to modify all these strings later, and I see
it
> > as a good idea to use an INSERT approach, but C# is not C++ and doesn't
> > allow me just to insert some external file as I used to do. What's a
command
> > for that?
> >
> > Thanks,
> > Dmitri.
>
> Create a class in its own file, and add the string constants to it.
>
> e.g.:
>
> public sealed class StringConstants
> {
> // private constructor to stop it getting instantiated
> private StringConstants()
> {
> }
>
> public const string One = "One";
> public const string Two = "Two";
> }
>
> Then later you can use StringConstants.One, etc.
- Next message: v-jetan_at_online.microsoft.com: "Re: Any Tool that can explore DLL"
- Previous message: The Poster Formerly Known as Kline Sphere: "Re: Variables in catch(...) clauses?"
- In reply to: Dmitri Shvetsov: "Re: INCLUDE"
- Next in thread: Dmitri Shvetsov: "Re: INCLUDE"
- Reply: Dmitri Shvetsov: "Re: INCLUDE"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|