[MonoDevelop] Fwd: Visual Studio Web Project
Michael Hutchinson
m.j.hutchinson at gmail.com
Thu Aug 30 07:02:04 EDT 2007
On 8/30/07, Patrick Barry <drpatrickbarry at gmail.com> wrote:
<snip>
> > But I suppose I could get around this by declaring a
> > CodeFileBaseClass along the lines of:
> >
> > <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test.aspx.cs"
> > Inherits="test" CodeFileBaseClass="MyBase"%>
>
> I'm not quite sure what you mean by this.
>
> -------------------------------------
> In my current contract I have developing a number of screens to display
> train timetables. Each one has a table created in a repeater and they all
> have navigation anchors with runat=server to move forward/backward 1hr, etc
> in the time table. I put common functionality for the anchors onServerclick
> events in a base page. But this would not work because the anchors would
> only exist in the partial classes for each page.
>
> So I done this:
>
> <%@ Reference Page="GridBase.aspx" %>
> <%@ Page Language="C#" MasterPageFile="~/MasterPage.master"
> CodeFileBaseClass="MyNameSpace.GridBase_aspx" AutoEventWireup="true"
> CodeFile="summary.aspx.cs" Inherits="MyNameSpace.summary_aspx" %>
>
> And then in the base page I have:
> protected HtmlAnchor sixtyd;
> protected HtmlAnchor tend;
> protected HtmlAnchor oned;
> protected HtmlAnchor oneu;
> protected HtmlAnchor tenu;
> protected HtmlAnchor sixtyu;
> protected HtmlAnchor sixtydB;
> protected HtmlAnchor tendB;
> protected HtmlAnchor onedB;
> protected HtmlAnchor oneuB;
> protected HtmlAnchor tenuB;
> protected HtmlAnchor sixtyuB;
>
> I have this declaration on each page. When Visual Studio complies this page
If VS (rather than the webserver) is doing the compilation, then are
you using the Web Application project type?
> it first checks in the GridBase.aspx.cs file to check if any declarations
> have have been made for the runat=server components. If they are there then
> they will not be created in the partial class.
Ah, that's useful when you're doing a sort of multi-layered
CodeBehind.. I'll need to make sure that MD checks for members in base
classes when adding CodeBehind members (and CodeFileBaseClass).
> It would then be possible to inherit every page from a base page (I wonder
> if the CodeFileBaseClass could be itself !!! Then a base class would
> not be requried) and declare everything so the
> tempory partial class file would have no decerations in it.
I'm still not quite sure what you mean my the temporary partial class.
When the web server generates them, they're temporary. The VS2005 "Web
Site" model simulates them for code completion. The VS2005 "Web
Application" model keeps them around. Or am I wrong? (I don't use
VS...)
> The soulution could then then be developed in both VS and MD, usefull on my
> dual boot machine. I was doing this for a few months 2 years ago on a .Net 1
> solution with MD 0.7.
Well, if it works, give it a go. I'd recommend trying the ASP.NET
AddIn (MD would need to be built with --enable-aspnet), though it's
not quite complete.
--
Michael Hutchinson
http://mjhutchinson.com
More information about the Monodevelop-list
mailing list