Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Webforms


Message #1 by "David Higgins" <wrox@d...> on Fri, 10 Aug 2001 19:06:34 -0700

Hi,



Does anyone have any best practice advice for creating a website which has

pages with a common header footer etc?  With ASP we use to use include files

and I was just wondering if there was a more cleaner way using inheritance

in ASP.Net from a template type webform i.e. I know can create custom

controls inheriting from web controls except I would like to use the whole

webform ?



David



Message #2 by "Thomas Tomiczek" <t.tomiczek@t...> on Sat, 11 Aug 2001 06:45:23 +0200
We have a framework for visual inheritance :-) Inherit your page from a

template, just replacing parts of the page :-)



Thomas Tomiczek

THONA Consulting Ltd.



-----Original Message-----

From: David Higgins [mailto:wrox@d...]

Sent: Samstag, 11. August 2001 04:07

To: ASP+

Subject: [aspx] Webforms





Hi,



Does anyone have any best practice advice for creating a website which

has

pages with a common header footer etc?  With ASP we use to use include

files

and I was just wondering if there was a more cleaner way using

inheritance

in ASP.Net from a template type webform i.e. I know can create custom

controls inheriting from web controls except I would like to use the

whole

webform ?



David





Message #3 by "pardo" <mpredajniansky@s...> on Tue, 14 Aug 2001 05:34:01
> 

> Hi,

> 

> Does anyone have any best practice advice for creating a website which 

has

> pages with a common header footer etc?  With ASP we use to use include 

files

> and I was just wondering if there was a more cleaner way using 

inheritance

> in ASP.Net from a template type webform i.e. I know can create custom

> controls inheriting from web controls except I would like to use the 

whole

> webform ?

> 

> David

> 

Hi,



 If you want to use common part in pages you can create it as Web User 

Control. WUC is .ascx file and you can use this in page as Web Control, 

where do you want. For more look at the .NET framework samples or at the 

MSDN



Pardo
Message #4 by "pardo" <mpredajniansky@s...> on Tue, 14 Aug 2001 10:35:18
Hi,

  there is small example from .NET framework



FILE:pagelet2.aspx



<%@ Register TagPrefix="Acme" TagName="Message" Src="pagelet2.ascx" %>

<html>

  <script language="C#" runat="server">

      void SubmitBtn_Click(Object sender, EventArgs E) {

          MyMessage.Text = "Message text changed!";

          MyMessage.Color = "red";

      }

  </script>

<body style="font: 10pt verdana">

  <h3>A Simple User Control w/ Properties</h3>

  <form runat="server">

    <Acme:Message id="MyMessage" Text="This is a custom message!" 

Color="blue" runat="server"/>

    <p>

    <asp:button text="Change Properties" OnClick="SubmitBtn_Click" 

runat=server/>

  </form>

</body>

</html>



FILE: pagelet2.ascx



<script language="C#" runat="server">

  public String Color = "blue";

  public String Text = "This is a simple message user control!";

</script>

<span id="Message" style="color:<%=Color%>"><%=Text%></span>



Both files must be at the same web directories



Pardo

  Return to Index