Loading ...
Sorry, an error occurred while loading the content.

1673RE: .NET-style components and development

Expand Messages
  • John Drago
    Apr 9, 2004
      Here's more.

      If I have a component BlueButton.ascx which extends Button.ascx, I
      should be able to do something like this within BlueButton.ascx:

      [inside BlueButton.ascx]
      <asp:Button id="$s->{id}" style="background-color: blue;" runat="server"
      />
      We could also have other components within *.ascx files. For instance:
      <asp:Label id="theLabel" style="color: red;" runat="server" />
      <% $theLabel->{text} = q{Here's some "Text" for "theLabel"}; %>

      This page shows an example of this in ASP.NET:
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
      tml/frlrfSystemWebUIUserControlClassTopic.asp?frame=true


      Thanks,
      John Drago


      | -----Original Message-----
      | From: Josh Chamas [mailto:josh@...]
      | Sent: Thursday, April 08, 2004 11:02 PM
      | To: John Drago
      | Cc: asp@...
      | Subject: Re: .NET-style components and development
      |
      | John Drago wrote:
      | > If anyone is interested,
      | >
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
      | > tml/frlrfSystemWebUI.asp?frame=true is the msdn section dealing with
      the
      | > System.Web.UI namespace.
      | >
      | > My guess is that 80% of what's there is unnecessary to get the
      desired
      | > functionality. By chance or fate, 80% of what's there has no place
      in a
      | > perl implementation of similar functionality, because of the tools
      | > already available within perl.
      |
      | Sorry I have not gotten back to you on this yet. I wanted to give the
      | Net stuff a good read first before I started an informed discussion
      | with you about this, which I still have not done :( . I would like to
      | extend the Apache::ASP framework to be able to handle extensions that
      | can fully replicate the .NET taglibs, and I understand that the
      XMLSubs
      | falls well short of that. I am not sure about other aspects of the
      | newer objects architecture, but there may be a place for those also.
      |
      | To help focus the discussion, it may be useful to know exactly what
      | feature(s) would be useful for you to begin work on as a shorter term
      | goal.
      | It seemed like the dynamic list boxes was a place you wanted to start
      | at, but more input here would be good.
      |
      | Regards,
      |
      | Josh
      |
      | >
      | > -------------------------------------------------------------------
      | > I figure we would need to emulate the functionality of:
      System.Web.UI
      | > (as a base class, and defining certain constants).
      | >
      | > o System.Web.UI.Control (base class, inherited by all default and
      | > custom controls).
      | >
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
      | > tml/frlrfSystemWebUIControlClassTopic.asp?frame=true
      | >
      | > o System.Web.UI.ControlCollection (this functionality could be
      rolled
      | > into System.Web.UI.Control).
      | >
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
      | > tml/frlrfSystemWebUIControlCollectionClassTopic.asp?frame=true
      | >
      | > o System.Web.UI.IPostBackDataHandler & IPostBackEventHandler
      | > (inheritable interface that allows controls to handle how their
      postback
      | > data is handled).
      | >
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
      | > tml/frlrfSystemWebUIIPostBackDataHandlerClassTopic.asp?frame=true
      | >
      | > o System.Web.UI.Page (represents an .aspx file, and is used as a
      base
      | > class when creating a web forms class in codebehind mode).
      | >
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
      | > tml/frlrfSystemWebUIPageClassTopic.asp?frame=true
      | >
      | > o System.Web.UI.PageParser (parses .aspx files).
      | >
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
      | > tml/frlrfSystemWebUIPageParserClassTopic.asp?frame=true
      | >
      | > o System.Web.UI.TemplateBuilder (supports the PageParser in
      building a
      | > template and the child controls it contains).
      | >
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
      | > tml/frlrfSystemWebUITemplateBuilderClassTopic.asp?frame=true
      | >
      | > o System.Web.UI.TemplateControl (inheritable base class. Provides
      the
      | > Page class and UserControl class a base set of functionality).
      | >
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
      | > tml/frlrfSystemWebUITemplateControlClassTopic.asp?frame=true
      | >
      | > o System.Web.UI.UserControl (represents an .ascx file which
      implements
      | > and/or extends the TemplateControl class to produce some
      functionality
      | > or html).
      | >
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
      | > tml/frlrfSystemWebUIUserControlClassTopic.asp?frame=true
      | >
      | > o System.Web.UI.UserControlControlBuilder (Does a recursive descent
      | > into the sub-controls contained within a UserControl, building them
      as
      | > it goes, so that UserControls can contain other controls inside
      them).
      | >
      http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/h
      | >
      tml/frlrfSystemWebUIUserControlControlBuilderClassTopic.asp?frame=true
      | >
      | > -------------------------------------------------------------------
      | >
      | > Let me make myself clear. I do not want to duplicate the entire
      ASP.NET
      | > thing in perl. I merely wish to skim the good stuff off the top and
      | > move along. In fact, there's more I dislike about ASP.NET than
      there is
      | > I *do* like about it. However, I recognize some things there that
      could
      | > save me loads of time on a large-scale project.
      | >
      | > Mason has some similar functionality with its *.mas components
      | > http://www.masonbook.com/book/chapter-1.mhtml#TOC-ANCHOR-3 but lacks
      the
      | > PostBack way of dealing with round-trip forms (as with server-side
      form
      | > validation). It also lacks the built-in ability to do things like
      | > append listitems to a <select> tag.
      | >
      | > _______________________________________________________________
      | >
      | > John Drago | Chief Architect of Software Development
      | > E-com Media Group, Inc. [www.e-commedia.com]
      | > office
      | > ::
      | > 303.790.7940 x25
      | > email
      | > ::
      | > jdrago@...
      | >
      | >
      | >
      | > E - b u s i n e s s w i t h D i m e n s i o n TM
      | >
      | >
      | > | -----Original Message-----
      | > | From: Josh Chamas [mailto:josh@...]
      | > | Sent: Monday, March 15, 2004 5:19 PM
      | > | To: asp@...
      | > | Subject: Re: .NET-style components and development
      | > |
      | > | John Drago wrote:
      | > | >
      | > | > What I want to do would look something like so:
      | > | > ---------------------------------------------------------------
      | > | > [listbox.asp]
      | > | >
      | > | > <asp:listbox id="list1">
      | > | > <asp:listitem>Select One</asp:listitem>
      | > | > </asp:listbox>
      | > | >
      | > | > <%
      | > | > # Dynamically add items to the list before it's rendered:
      | > | > $Page->list1->Items->add(
      | > | > asp::listitem->new( Value => "1", Text => "Blue" ) );
      | > | > $Page->list1->Items->add(
      | > | > asp::listitem->new( Value => "2", Text => "Red" ) );
      | > | >
      | > | > # or, iterate through items within the listbox:
      | > | > foreach my $item ( $Page->list1->Items )
      | > | > {
      | > | > if( $item->Value == 1 )
      | > | > {
      | > | > $item->Text = "Blue [this is my favorite...isn't it
      yours?]";
      | > | > }# end if()
      | > | > }# end foreach()
      | > | >
      | > | > %>
      | > | > ---------------------------------------------------------------
      | > | >
      | > | > Something tells me that this isn't too far away from what we
      already
      | >
      | > | > have with Apache::ASP...that with some extra methods inherited
      from
      | > | > a package subclassed by asp::listbox and asp::listitem, it is
      100%
      | > | > possible.
      | > | >
      | > | > I would need some help with where to bless the $Page object into
      the
      | >
      | > | > namespace the ASP pages are executed in.
      | > | >
      | > |
      | > | If you set up a $List object in global.asa, it will be seen in
      | > | includes and scripts, but not in the scope of the XMLSubs
      packages.
      | > | So you might create it in the main package to reference from like
      | > | this:
      | > |
      | > | # global.asa
      | > | use vars qw($List);
      | > | sub Script_OnStart {
      | > | $List = $main::List = List->new();
      | > | }
      | > | sub Script_OnEnd {
      | > | $List->can('DESTROY') && $List->DESTROY;
      | > | $List = $main::List = undef;
      | > | }
      | > |
      | > | Then in the script, you can:
      | > |
      | > | <%
      | > | $List->->add('list1',
      | > | ListItem->new( Value => "1", Text => "Blue" )
      | > | );
      | > | %>
      | > |
      | > | And then you can:
      | > |
      | > | <asp:listbox id="list1">
      | > | <asp:listitem>Select One</asp:listitem>
      | > | </asp:listbox>
      | > |
      | > | And have XMLSubs defined to handle asp:listbox & asp:listitem
      | > | properly, looking at the $main::List object.
      | > |
      | > | If you really want to build objects through code though, you might
      | > | check out CGI.pm, which has plenty of methods for doing exactly
      this.
      | >
      | > | Output from a CGI.pm object should be compatible with Apache::ASP.
      | > |
      | > | > Apache::ASP does *almost* everything I want it to do, and this
      kind
      | > | > of extension would make it a lot more powerful in my opinion.
      | > |
      | > | What is the extension in particular that you are looking for? Is
      there
      | >
      | > | something particular about <asp:listbox /> handling that you like
      in
      | > | ASP.NET that you want implemented as is? Particularly what
      features
      | > | of ASP.NET do you think should make it into Apache::ASP ?
      | > |
      | > | Regards,
      | > |
      | > | Josh
      | > |
      | > |
      | >
      ________________________________________________________________________
      | > | Josh Chamas, Founder | NodeWorks - http://www.nodeworks.com
      | > | Chamas Enterprises Inc. | NodeWorks Directory -
      | > http://dir.nodeworks.com
      | > | http://www.chamas.com | Apache::ASP - http://www.apache-asp.org
      | > |
      | > |
      | > |
      | > |
      | > |
      ---------------------------------------------------------------------
      | > | To unsubscribe, e-mail: asp-unsubscribe@...
      | > | For additional commands, e-mail: asp-help@...
      | >
      | >
      | >
      | >
      ---------------------------------------------------------------------
      | > To unsubscribe, e-mail: asp-unsubscribe@...
      | > For additional commands, e-mail: asp-help@...
      | >
      | >
      |
      |
      |
      | ---------------------------------------------------------------------
      | To unsubscribe, e-mail: asp-unsubscribe@...
      | For additional commands, e-mail: asp-help@...
      |



      ---------------------------------------------------------------------
      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Show all 13 messages in this topic