Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Re: More about Beta 2


Message #1 by "David Brophy" <daveb@c...> on Fri, 6 Oct 2000 15:22:06 +0100
Will you be able to have more than one pagelet per file? - Or can you do

this already? - I've _just_ started playing with ASP+, and it seems as if

this may be a problem...



In ASP sites, I have a functions file that has lots of functions (that

output HTML as well as compute things) - I think these would work great as

pagelets, but having to have lots of files in an include directory will be

annoying to say the least.

Message #2 by "Ben Prater" <bprater@p...> on Fri, 6 Oct 2000 10:29:46 -0400
I doubt there is a one pagelet per file maximum.



However, I think that you'd want to replace function 'files' with actual

classes in VB/C# if it's possible. It would be a much cleaner

implementation -- plus you wouldn't have the overhead of preloading

functions in the 'files' that you might not necessarily need. (CLR will load

needed functions dynamically.)



Ben



> -----Original Message-----

> From: David Brophy [mailto:daveb@c...]

> Sent: Friday, October 06, 2000 10:22 AM

> To: ASP+

> Subject: [aspx] Re: More about Beta 2

>

>

> Will you be able to have more than one pagelet per file? - Or can you do

> this already? - I've _just_ started playing with ASP+, and it seems as if

> this may be a problem...

>

> In ASP sites, I have a functions file that has lots of functions (that

> output HTML as well as compute things) - I think these would work great as

> pagelets, but having to have lots of files in an include directory will be

> annoying to say the least.

>

> ---



Message #3 by "Thomas Tomiczek" <thona@g...> on Fri, 6 Oct 2000 16:33:03 +0200
This is a multi-part message in MIME format.



------_=_NextPart_001_01C02FA2.55B20974

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



Sorry to say but you are misusing pagelets.



If you want to cover LOTS of functions, make a class (or a pagelet) and

expose every function as a function of the class.



Pagelets are for visual components. Actually they COULD also be written

as WebformControls (faster) and then one assembly could contain

thousands of these controls.



Pagelets are NOT ment to handle "function libraries", especially not

with every function becoming an independent pagelet.



Thomas Tomicezk





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

From: David Brophy [mailto:daveb@c...]

Sent: Freitag, 6. Oktober 2000 16:22

To: ASP+

Subject: [aspx] Re: More about Beta 2





Will you be able to have more than one pagelet per file? - Or can you do

this already? - I've _just_ started playing with ASP+, and it seems as

if

this may be a problem...



In ASP sites, I have a functions file that has lots of functions (that

output HTML as well as compute things) - I think these would work great

as

pagelets, but having to have lots of files in an include directory will

be

annoying to say the least.



---






Message #4 by "Thomas Tomiczek" <thona@g...> on Fri, 6 Oct 2000 17:02:19 +0200
This is a multi-part message in MIME format.



------_=_NextPart_001_01C02FA6.6C6B0FEA

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



Hello,



there IS a maximum of one pagelets tobe defined in one file - similar to

only one ASP page in one file.



Thomas Tomiczek



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

From: Ben Prater [mailto:bprater@p...]

Sent: Freitag, 6. Oktober 2000 16:30

To: ASP+

Subject: [aspx] Re: More about Beta 2





I doubt there is a one pagelet per file maximum.



However, I think that you'd want to replace function 'files' with actual

classes in VB/C# if it's possible. It would be a much cleaner

implementation -- plus you wouldn't have the overhead of preloading

functions in the 'files' that you might not necessarily need. (CLR will

load

needed functions dynamically.)



Ben



> -----Original Message-----

> From: David Brophy [mailto:daveb@c...]

> Sent: Friday, October 06, 2000 10:22 AM

> To: ASP+

> Subject: [aspx] Re: More about Beta 2

>

>

> Will you be able to have more than one pagelet per file? - Or can you

do

> this already? - I've _just_ started playing with ASP+, and it seems as

if

> this may be a problem...

>

> In ASP sites, I have a functions file that has lots of functions (that

> output HTML as well as compute things) - I think these would work

great as

> pagelets, but having to have lots of files in an include directory

will be

> annoying to say the least.

>

> ---





---






Message #5 by David Brophy <daveb@c...> on Fri, 06 Oct 2000 17:15:55 +0100
On Fri, 6 Oct 2000 16:33:03 +0200, you wrote:



>Sorry to say but you are misusing pagelets.

>

>If you want to cover LOTS of functions, make a class (or a pagelet) and

>expose every function as a function of the class.

>

>Pagelets are for visual components. Actually they COULD also be written

>as WebformControls (faster) and then one assembly could contain

>thousands of these controls.

>

>Pagelets are NOT ment to handle "function libraries", especially not

>with every function becoming an independent pagelet.

>



Oh dear - V.confused. I have lived and breathed ASP for the last

two years, but have never really done object orientated

programming.



It looks to be a steep learning curve... Are there any beginners

resources for the C# language? - The MS help file that came with

the NGWS SDK is less than intuitive. For example - i've spent the

last half hour looking for the best way to do a simple instr()

(find a substring in a string)...





- David Brophy

Director, Cambro Limited,

(023) 80 679550

daveb@c...

Message #6 by Aaron Montgomery <Aaron.Montgomery@C...> on Fri, 6 Oct 2000 10:14:47 -0700
Presenting C#, SAMS Publishing - ISBN 0672320371



There is also another book coming out titled "A Programmers Introduction to

C#", that is all the more that I can remember about it to be honest other

then I believe someone from the C# QA team wrote it.  You might also

consider picking up a book dealing with Visual Basic (I assume this is the

language you used with ASP) and COM/DCOM.  I found it helpful to use this to

help me ramp up on C# because I didn't need to worry about language

specifics while learning OO.  Just a thought.



Hope it helps!



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

From: David Brophy [mailto:daveb@c...]

Sent: Friday, October 06, 2000 9:16 AM

To: ASP+

Subject: [aspx] Re: More about Beta 2





On Fri, 6 Oct 2000 16:33:03 +0200, you wrote:



>Sorry to say but you are misusing pagelets. 

>

>If you want to cover LOTS of functions, make a class (or a pagelet) and

>expose every function as a function of the class.

>

>Pagelets are for visual components. Actually they COULD also be written

>as WebformControls (faster) and then one assembly could contain

>thousands of these controls.

>

>Pagelets are NOT ment to handle "function libraries", especially not

>with every function becoming an independent pagelet.

>



Oh dear - V.confused. I have lived and breathed ASP for the last

two years, but have never really done object orientated

programming. 



It looks to be a steep learning curve... Are there any beginners

resources for the C# language? - The MS help file that came with

the NGWS SDK is less than intuitive. For example - i've spent the

last half hour looking for the best way to do a simple instr()

(find a substring in a string)...





- David Brophy

Director, Cambro Limited,

(023) 80 679550 

daveb@c...



---

Message #7 by "Thomas Tomiczek" <thona@g...> on Fri, 6 Oct 2000 19:36:16 +0200
This is a multi-part message in MIME format.



------_=_NextPart_001_01C02FBB.EE313FEE

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



Well, its not actually a Problem about C#.



See, the Webforms Framework allows you have "Server side COntrols", much

like Components in "regular ASP" have been, such as the DataGrid.



Normally (when performance counts) these will be created and compiled

and come from an Assembly.



But if seldom used or during prototyping, you can define them as

pagelets.



There is a good introduction into C# somewhere on the MS Site, but I

definitly recommend some GOOD books about OO. It is REALLY great.



For example, I currently build an online community. I use (well, try to

- still some problems) visual inheritance, in which (dynamically at

compile time) a page can actually be based on another page. Its

extremely fast, simple and powerful (just still with a bug).



Thomas Tomiczek



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

From: David Brophy [mailto:daveb@c...]

Sent: Freitag, 6. Oktober 2000 18:16

To: ASP+

Subject: [aspx] Re: More about Beta 2





On Fri, 6 Oct 2000 16:33:03 +0200, you wrote:



>Sorry to say but you are misusing pagelets.

>

>If you want to cover LOTS of functions, make a class (or a pagelet) and

>expose every function as a function of the class.

>

>Pagelets are for visual components. Actually they COULD also be written

>as WebformControls (faster) and then one assembly could contain

>thousands of these controls.



>

>Pagelets are NOT ment to handle "function libraries", especially not

>with every function becoming an independent pagelet.

>



Oh dear - V.confused. I have lived and breathed ASP for the last

two years, but have never really done object orientated

programming.



It looks to be a steep learning curve... Are there any beginners

resources for the C# language? - The MS help file that came with

the NGWS SDK is less than intuitive. For example - i've spent the

last half hour looking for the best way to do a simple instr()

(find a substring in a string)...





- David Brophy

Director, Cambro Limited,

(023) 80 679550

daveb@c...



---






Message #8 by Robert Scoble <rscoble@F...> on Fri, 6 Oct 2000 17:10:53 -0700
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C02FF2.9904B4EC

Content-Type: text/plain;

	charset="iso-8859-1"



> There is also another book coming out titled "A Programmers 

> Introduction to

> C#", that is all the more that I can remember about it to be 

> honest other

> then I believe someone from the C# QA team wrote it. 



DevX.com is tracking all .NET books at

http://www.devx.com/dotnet/resources/. The book in question is from

http://www.apress.com



Robert Scoble

### 




Message #9 by Scott Guthrie <scottgu@m...> on Sat, 7 Oct 2000 17:20:39 -0700
Note that you *can* use pagelets to encapsulate multiple functions -- and

then use them like a function library (like you asked for in your origional

post).  For example:



MyPageletLibrary.ascx (Reusable pagelet library):



<script language="VB" runat=server>



   public function Add(x as integer, y as integer) as integer

      Add = x + y

   end function



   public function Subtract(x as integer, y as integer) as integer

      Subtract = x - y

   end function



</script>



MyPage.aspx (page that will use the pagelet library):



<%@ Reference TagPrefix="Brophy" TagName="Library"

Src="MyPageletLibrary.ascx" %>



<html>



   <Brophy:Library id="FunctionLibrary" runat=server/>



   <body>



       Add Two Numbers: <%= FunctionLibrary.Add(5, 6) %>



       <br><br>



       Subtract Two Numbers: <%= FunctionLibrary.Subtract(8, 2) %>



   </body>



</html>



What Thomas and others are hinting at in the other posts, however, is that

there are other ways to encapsulate this type of functionality as well.

Rather than use pagelets as function libraries, you might encapsulate these

functions directly within VB classes.  That way they'd be accessible not

only from ASP+ Pages -- but also from ASP+ Services and generic business

components as well.



Hope this helps,



Scott



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

From: David Brophy [mailto:daveb@c...]

Sent: Friday, October 06, 2000 9:16 AM

To: ASP+

Subject: [aspx] Re: More about Beta 2





On Fri, 6 Oct 2000 16:33:03 +0200, you wrote:



>Sorry to say but you are misusing pagelets. 

>

>If you want to cover LOTS of functions, make a class (or a pagelet) and

>expose every function as a function of the class.

>

>Pagelets are for visual components. Actually they COULD also be written

>as WebformControls (faster) and then one assembly could contain

>thousands of these controls.

>

>Pagelets are NOT ment to handle "function libraries", especially not

>with every function becoming an independent pagelet.

>



Oh dear - V.confused. I have lived and breathed ASP for the last

two years, but have never really done object orientated

programming. 



It looks to be a steep learning curve... Are there any beginners

resources for the C# language? - The MS help file that came with

the NGWS SDK is less than intuitive. For example - i've spent the

last half hour looking for the best way to do a simple instr()

(find a substring in a string)...





- David Brophy

Director, Cambro Limited,

(023) 80 679550 

daveb@c...



---

Message #10 by David Brophy <daveb@c...> on Mon, 09 Oct 2000 09:36:15 +0100
On Sat, 7 Oct 2000 17:20:39 -0700 , you wrote:



>Note that you *can* use pagelets to encapsulate multiple functions -- 

and

>then use them like a function library (like you asked for in your 

origional

>post).  For example:

>

>MyPageletLibrary.ascx (Reusable pagelet library):

>

><script language=3D"VB" runat=3Dserver>

>

>   public function Add(x as integer, y as integer) as integer

>      Add =3D x + y

>   end function

>

>   public function Subtract(x as integer, y as integer) as integer

>      Subtract =3D x - y

>   end function

>

></script>

>

>MyPage.aspx (page that will use the pagelet library):

>

><%@ Reference TagPrefix=3D"Brophy" TagName=3D"Library"

>Src=3D"MyPageletLibrary.ascx" %>

>

><html>

>

>   <Brophy:Library id=3D"FunctionLibrary" runat=3Dserver/>

>

>   <body>

>

>       Add Two Numbers: <%=3D FunctionLibrary.Add(5, 6) %>

>

>       <br><br>

>

>       Subtract Two Numbers: <%=3D FunctionLibrary.Subtract(8, 2) %>

>

>  

>---

></BODY>

>

></html>

>

>What Thomas and others are hinting at in the other posts, however, is 

that

>there are other ways to encapsulate this type of functionality as well.

>Rather than use pagelets as function libraries, you might encapsulate 

these

>functions directly within VB classes.  That way they'd be accessible not

>only from ASP+ Pages -- but also from ASP+ Services and generic business

>components as well.

>

>Hope this helps,

>

>Scott

>

>-----Original Message-----

>From: David Brophy [mailto:daveb@c...]

>Sent: Friday, October 06, 2000 9:16 AM

>To: ASP+

>Subject: [aspx] Re: More about Beta 2

>

>

>On Fri, 6 Oct 2000 16:33:03 +0200, you wrote:

>

>>Sorry to say but you are misusing pagelets.

>>

>>If you want to cover LOTS of functions, make a class (or a pagelet) and

>>expose every function as a function of the class.

>>

>>Pagelets are for visual components. Actually they COULD also be written

>>as WebformControls (faster) and then one assembly could contain

>>thousands of these controls.

>>

>>Pagelets are NOT ment to handle "function libraries", especially not

>>with every function becoming an independent pagelet.

>>

>

>Oh dear - V.confused. I have lived and breathed ASP for the last

>two years, but have never really done object orientated

>programming.

>

>It looks to be a steep learning curve... Are there any beginners

>resources for the C# language? - The MS help file that came with

>the NGWS SDK is less than intuitive. For example - i've spent the

>last half hour looking for the best way to do a simple instr()

>(find a substring in a string)...

>

>

>- David Brophy

>Director, Cambro Limited,

>(023) 80 679550

>daveb@c...

>

>---







The problem I have with this, is that these functions cannot have

HTML and code interlaced - With a pagelet I can have the html

code formatted as HTML - With a function it must be formatted as

a bunch of variable definitions, thus:



str_var="<this is some HTML - be sure to turn double quotes"&_

"into double double quotes"



As most of my functions I want output large sections of HTML to

the page, It would be great to not have to stuff the HTML into

variables.



Is there any way in VB/C# to say 'stuff the following text into a

variable until you get to a <% marker'?



I know in perl you can do it...





- David Brophy

Director, Cambro Limited,

(023) 80 679550

daveb@c...

Message #11 by "Thomas Tomiczek" <thona@g...> on Mon, 9 Oct 2000 13:05:15 +0200
This is a multi-part message in MIME format.



------_=_NextPart_001_01C031E0.CD749E82

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



David, this is not a problem.



With functions generating HTML it sould be best to restructure them into

Pagelets, though NOT on a 1:1-base.



I had a similar "problem": 2 functions to create a "frame" around

content. They became one Pagelet that wraps the content in the form

<start>

	content here

</start>



Make good use of this.



Thomas



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

From: David Brophy [mailto:daveb@c...]

Sent: Montag, 9. Oktober 2000 10:36

To: ASP+

Subject: [aspx] Re: More about Beta 2



The problem I have with this, is that these functions cannot have

HTML and code interlaced - With a pagelet I can have the html

code formatted as HTML - With a function it must be formatted as

a bunch of variable definitions, thus:



str_var=3Dthis is some HTML - be sure to turn double quotes"&_

"into double double quotes"



As most of my functions I want output large sections of HTML to

the page, It would be great to not have to stuff the HTML into

variables.



Is there any way in VB/C# to say 'stuff the following text into a

variable until you get to a <% marker'?



I know in perl you can do it...





- David Brophy

Director, Cambro Limited,

(023) 80 679550

daveb@c...






Message #12 by David Brophy <daveb@c...> on Mon, 09 Oct 2000 13:29:02 +0100
On Mon, 9 Oct 2000 13:05:15 +0200, you wrote:



>David, this is not a problem.

>

>With functions generating HTML it sould be best to restructure them into

>Pagelets, though NOT on a 1:1-base.

>

>I had a similar "problem": 2 functions to create a "frame" around

>content. They became one Pagelet that wraps the content in the form

>

><start>

>        content here

></start>



Brilliant - thankyou.





- David Brophy

Director, Cambro Limited,

(023) 80 679550

daveb@c...

Message #13 by "Thomas Tomiczek" <thona@g...> on Mon, 9 Oct 2000 14:27:40 +0200
This is a multi-part message in MIME format.



------_=_NextPart_001_01C031EC.50AE8492

Content-Type: text/plain;

	charset="iso-8859-1"

Content-Transfer-Encoding: quoted-printable



Not really, but it has a lot of advantages:



(a) more native to read

(b) catches semantic error of misusing (missing start of end tag) at

compile time.



Thomas



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

From: David Brophy [mailto:daveb@c...]

Sent: Montag, 9. Oktober 2000 14:29

To: ASP+

Subject: [aspx] Re: More about Beta 2





On Mon, 9 Oct 2000 13:05:15 +0200, you wrote:



></start>



Brilliant - thankyou.





- David Brophy

Director, Cambro Limited,

(023) 80 679550

daveb@c...



---






Message #14 by Amod Kamble <Amod.Kamble@r...> on Mon, 9 Oct 2000 11:28:56 -0700

Hi All,



I was trying to use this concept of pagelets to encapsulate functions. I

tried the exact same example as Scott described below.

But seems to throw an error and do not work. Could anyone help me on this.

Also how diffent is the extension of pagelets .aspc from .ascx.





Cheers

Amod





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

From: Scott Guthrie [mailto:scottgu@m...]

Sent: Saturday, October 07, 2000 5:21 PM

To: ASP+

Subject: [aspx] Re: More about Beta 2





Note that you *can* use pagelets to encapsulate multiple functions -- and

then use them like a function library (like you asked for in your origional

post).  For example:



MyPageletLibrary.ascx (Reusable pagelet library):



<script language="VB" runat=server>



   public function Add(x as integer, y as integer) as integer

      Add = x + y

   end function



   public function Subtract(x as integer, y as integer) as integer

      Subtract = x - y

   end function



</script>



MyPage.aspx (page that will use the pagelet library):



<%@ Reference TagPrefix="Brophy" TagName="Library"

Src="MyPageletLibrary.ascx" %>



<html>



   <Brophy:Library id="FunctionLibrary" runat=server/>



   <body>



       Add Two Numbers: <%= FunctionLibrary.Add(5, 6) %>



       <br><br>



       Subtract Two Numbers: <%= FunctionLibrary.Subtract(8, 2) %>



   

---

</BODY>



</html>



What Thomas and others are hinting at in the other posts, however, is that

there are other ways to encapsulate this type of functionality as well.

Rather than use pagelets as function libraries, you might encapsulate these

functions directly within VB classes.  That way they'd be accessible not

only from ASP+ Pages -- but also from ASP+ Services and generic business

components as well.



Hope this helps,



Scott



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

From: David Brophy [mailto:daveb@c...]

Sent: Friday, October 06, 2000 9:16 AM

To: ASP+

Subject: [aspx] Re: More about Beta 2





On Fri, 6 Oct 2000 16:33:03 +0200, you wrote:



>Sorry to say but you are misusing pagelets. 

>

>If you want to cover LOTS of functions, make a class (or a pagelet) and

>expose every function as a function of the class.

>

>Pagelets are for visual components. Actually they COULD also be written

>as WebformControls (faster) and then one assembly could contain

>thousands of these controls.

>

>Pagelets are NOT ment to handle "function libraries", especially not

>with every function becoming an independent pagelet.

>



Oh dear - V.confused. I have lived and breathed ASP for the last

two years, but have never really done object orientated

programming. 



It looks to be a steep learning curve... Are there any beginners

resources for the C# language? - The MS help file that came with

the NGWS SDK is less than intuitive. For example - i've spent the

last half hour looking for the best way to do a simple instr()

(find a substring in a string)...





- David Brophy

Director, Cambro Limited,

(023) 80 679550 

daveb@c...



---

Message #15 by Aaron Montgomery <Aaron.Montgomery@C...> on Mon, 9 Oct 2000 14:10:42 -0700
It is my understanding that with the PDC build of the framework you can

literally name your Pagelets whatever you want.  This apparently was

becoming a problem at Microsoft (if what I'm told is true), so they started

to standardize.  Eventually it was decided that .ascx would be the more

correct version of the extension and probably the next version of the

Framework will only allow .ascx.  Correct me if I'm wrong please.



As far as encapsulating functions go, I would think that you would be better

off writing them into a dll and just calling that instead of creating a

pagelet (which I believe are being called User Controls now).  Then in your

code behind class just add the dll to your using list.



i.e.:



using System;

using System.Web.UI.Page;

using MyObjects.ClassLibrary;



Again, my understanding is that VS.NET is going to create code behind

classes when it compiles the pages anyway, taking your <script> blocks for

the source.



If you really wanted to use a pagelet/user control to encapsulate multiple

functions, then Scott's example is correct with the possible exception of

the register tag.



The page directive he describes I've always written as:



<%@ Register TagPrefix="Brophy" TagName="Library"

src="MyPageletLibrary.ascx" %>



Instead of the Reference keyword he uses.



Hope that helps,

Aaron





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

From: Amod Kamble [mailto:Amod.Kamble@r...]

Sent: Monday, October 09, 2000 11:29 AM

To: ASP+

Subject: [aspx] Re: More about Beta 2







Hi All,



I was trying to use this concept of pagelets to encapsulate functions. I

tried the exact same example as Scott described below.

But seems to throw an error and do not work. Could anyone help me on this.

Also how diffent is the extension of pagelets .aspc from .ascx.





Cheers

Amod





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

From: Scott Guthrie [mailto:scottgu@m...]

Sent: Saturday, October 07, 2000 5:21 PM

To: ASP+

Subject: [aspx] Re: More about Beta 2





Note that you *can* use pagelets to encapsulate multiple functions -- and

then use them like a function library (like you asked for in your origional

post).  For example:



MyPageletLibrary.ascx (Reusable pagelet library):



<script language="VB" runat=server>



   public function Add(x as integer, y as integer) as integer

      Add = x + y

   end function



   public function Subtract(x as integer, y as integer) as integer

      Subtract = x - y

   end function



</script>



MyPage.aspx (page that will use the pagelet library):



<%@ Reference TagPrefix="Brophy" TagName="Library"

Src="MyPageletLibrary.ascx" %>



<html>



   <Brophy:Library id="FunctionLibrary" runat=server/>



   <body>



       Add Two Numbers: <%= FunctionLibrary.Add(5, 6) %>



       <br><br>



       Subtract Two Numbers: <%= FunctionLibrary.Subtract(8, 2) %>



   

---



---

</BODY>



</html>



What Thomas and others are hinting at in the other posts, however, is that

there are other ways to encapsulate this type of functionality as well.

Rather than use pagelets as function libraries, you might encapsulate these

functions directly within VB classes.  That way they'd be accessible not

only from ASP+ Pages -- but also from ASP+ Services and generic business

components as well.



Hope this helps,



Scott



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

From: David Brophy [mailto:daveb@c...]

Sent: Friday, October 06, 2000 9:16 AM

To: ASP+

Subject: [aspx] Re: More about Beta 2





On Fri, 6 Oct 2000 16:33:03 +0200, you wrote:



>Sorry to say but you are misusing pagelets. 

>

>If you want to cover LOTS of functions, make a class (or a pagelet) and

>expose every function as a function of the class.

>

>Pagelets are for visual components. Actually they COULD also be written

>as WebformControls (faster) and then one assembly could contain

>thousands of these controls.

>

>Pagelets are NOT ment to handle "function libraries", especially not

>with every function becoming an independent pagelet.

>



Oh dear - V.confused. I have lived and breathed ASP for the last

two years, but have never really done object orientated

programming. 



It looks to be a steep learning curve... Are there any beginners

resources for the C# language? - The MS help file that came with

the NGWS SDK is less than intuitive. For example - i've spent the

last half hour looking for the best way to do a simple instr()

(find a substring in a string)...





- David Brophy

Director, Cambro Limited,

(023) 80 679550 

daveb@c...



---



Message #16 by "Dave Sussman" <davids@i...> on Tue, 10 Oct 2000 10:03:53 +0100
Yes, .ascx is the new extension, so it's best if you use this from now on.

Once beta 1 comes out you'll have to go through all of your code and change

them 8(



And you're right, User Controls is what we should be calling them.

Personally I liked the term Pagelets, but I think the marketing people

insisted.



Dave



"Aaron Montgomery" <Aaron.Montgomery@C...> wrote in message

news:15630@a...

>

> It is my understanding that with the PDC build of the framework you can

> literally name your Pagelets whatever you want.  This apparently was

> becoming a problem at Microsoft (if what I'm told is true), so they

started

> to standardize.  Eventually it was decided that .ascx would be the more

> correct version of the extension and probably the next version of the

> Framework will only allow .ascx.  Correct me if I'm wrong please.

>

> As far as encapsulating functions go, I would think that you would be

better

> off writing them into a dll and just calling that instead of creating a

> pagelet (which I believe are being called User Controls now).  Then in

your

> code behind class just add the dll to your using list.

>

> i.e.:

>

> using System;

> using System.Web.UI.Page;

> using MyObjects.ClassLibrary;

>

> Again, my understanding is that VS.NET is going to create code behind

> classes when it compiles the pages anyway, taking your <script> blocks for

> the source.

>

> If you really wanted to use a pagelet/user control to encapsulate multiple

> functions, then Scott's example is correct with the possible exception of

> the register tag.

>

> The page directive he describes I've always written as:

>

> <%@ Register TagPrefix="Brophy" TagName="Library"

> src="MyPageletLibrary.ascx" %>

>

> Instead of the Reference keyword he uses.

>

> Hope that helps,

> Aaron

>

>

> -----Original Message-----

> From: Amod Kamble [mailto:Amod.Kamble@r...]

> Sent: Monday, October 09, 2000 11:29 AM

> To: ASP+

> Subject: [aspx] Re: More about Beta 2

>

>

>

> Hi All,

>

> I was trying to use this concept of pagelets to encapsulate functions. I

> tried the exact same example as Scott described below.

> But seems to throw an error and do not work. Could anyone help me on this.

> Also how diffent is the extension of pagelets .aspc from .ascx.

>

>

> Cheers

> Amod

>

>

> -----Original Message-----

> From: Scott Guthrie [mailto:scottgu@m...]

> Sent: Saturday, October 07, 2000 5:21 PM

> To: ASP+

> Subject: [aspx] Re: More about Beta 2

>

>

> Note that you *can* use pagelets to encapsulate multiple functions -- and

> then use them like a function library (like you asked for in your

origional

> post).  For example:

>

> MyPageletLibrary.ascx (Reusable pagelet library):

>

> <script language="VB" runat=server>

>

>    public function Add(x as integer, y as integer) as integer

>       Add = x + y

>    end function

>

>    public function Subtract(x as integer, y as integer) as integer

>       Subtract = x - y

>    end function

>

> </script>

>

> MyPage.aspx (page that will use the pagelet library):

>

> <%@ Reference TagPrefix="Brophy" TagName="Library"

> Src="MyPageletLibrary.ascx" %>

>

> <html>

>

>    <Brophy:Library id="FunctionLibrary" runat=server/>

>

>    <body>

>

>        Add Two Numbers: <%= FunctionLibrary.Add(5, 6) %>

>

>        <br><br>

>

>        Subtract Two Numbers: <%= FunctionLibrary.Subtract(8, 2) %>

>

>

> ---

>

> ---

> </BODY>

>

> </html>

>

> What Thomas and others are hinting at in the other posts, however, is that

> there are other ways to encapsulate this type of functionality as well.

> Rather than use pagelets as function libraries, you might encapsulate

these

> functions directly within VB classes.  That way they'd be accessible not

> only from ASP+ Pages -- but also from ASP+ Services and generic business

> components as well.

>

> Hope this helps,

>

> Scott

>

> -----Original Message-----

> From: David Brophy [mailto:daveb@c...]

> Sent: Friday, October 06, 2000 9:16 AM

> To: ASP+

> Subject: [aspx] Re: More about Beta 2

>

>

> On Fri, 6 Oct 2000 16:33:03 +0200, you wrote:

>

> >Sorry to say but you are misusing pagelets.

> >

> >If you want to cover LOTS of functions, make a class (or a pagelet) and

> >expose every function as a function of the class.

> >

> >Pagelets are for visual components. Actually they COULD also be written

> >as WebformControls (faster) and then one assembly could contain

> >thousands of these controls.

> >

> >Pagelets are NOT ment to handle "function libraries", especially not

> >with every function becoming an independent pagelet.

> >

>

> Oh dear - V.confused. I have lived and breathed ASP for the last

> two years, but have never really done object orientated

> programming.

>

> It looks to be a steep learning curve... Are there any beginners

> resources for the C# language? - The MS help file that came with

> the NGWS SDK is less than intuitive. For example - i've spent the

> last half hour looking for the best way to do a simple instr()

> (find a substring in a string)...

>

>

> - David Brophy

> Director, Cambro Limited,

> (023) 80 679550

> daveb@c...

>

> ---

>

>

>





Message #17 by Scott Guthrie <scottgu@m...> on Tue, 10 Oct 2000 15:39:07 -0700
Yikes.  My apologies.  I got cocky and sent the sample without running it...

:-(



Renaming "Reference" to "Register" should hopefully fix the problem.  



Sorry,



Scott



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

From: Amod Kamble [mailto:Amod.Kamble@r...]

Sent: Monday, October 09, 2000 11:29 AM

To: ASP+

Subject: [aspx] Re: More about Beta 2







Hi All,



I was trying to use this concept of pagelets to encapsulate functions. I

tried the exact same example as Scott described below.

But seems to throw an error and do not work. Could anyone help me on this.

Also how diffent is the extension of pagelets .aspc from .ascx.





Cheers

Amod





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

From: Scott Guthrie [mailto:scottgu@m...]

Sent: Saturday, October 07, 2000 5:21 PM

To: ASP+

Subject: [aspx] Re: More about Beta 2





Note that you *can* use pagelets to encapsulate multiple functions -- and

then use them like a function library (like you asked for in your origional

post).  For example:



MyPageletLibrary.ascx (Reusable pagelet library):



<script language="VB" runat=server>



   public function Add(x as integer, y as integer) as integer

      Add = x + y

   end function



   public function Subtract(x as integer, y as integer) as integer

      Subtract = x - y

   end function



</script>



MyPage.aspx (page that will use the pagelet library):



<%@ Reference TagPrefix="Brophy" TagName="Library"

Src="MyPageletLibrary.ascx" %>



<html>



   <Brophy:Library id="FunctionLibrary" runat=server/>



   <body>



       Add Two Numbers: <%= FunctionLibrary.Add(5, 6) %>



       <br><br>



       Subtract Two Numbers: <%= FunctionLibrary.Subtract(8, 2) %>



   

---



---

</BODY>



</html>



What Thomas and others are hinting at in the other posts, however, is that

there are other ways to encapsulate this type of functionality as well.

Rather than use pagelets as function libraries, you might encapsulate these

functions directly within VB classes.  That way they'd be accessible not

only from ASP+ Pages -- but also from ASP+ Services and generic business

components as well.



Hope this helps,



Scott



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

From: David Brophy [mailto:daveb@c...]

Sent: Friday, October 06, 2000 9:16 AM

To: ASP+

Subject: [aspx] Re: More about Beta 2





On Fri, 6 Oct 2000 16:33:03 +0200, you wrote:



>Sorry to say but you are misusing pagelets. 

>

>If you want to cover LOTS of functions, make a class (or a pagelet) and

>expose every function as a function of the class.

>

>Pagelets are for visual components. Actually they COULD also be written

>as WebformControls (faster) and then one assembly could contain

>thousands of these controls.

>

>Pagelets are NOT ment to handle "function libraries", especially not

>with every function becoming an independent pagelet.

>



Oh dear - V.confused. I have lived and breathed ASP for the last

two years, but have never really done object orientated

programming. 



It looks to be a steep learning curve... Are there any beginners

resources for the C# language? - The MS help file that came with

the NGWS SDK is less than intuitive. For example - i've spent the

last half hour looking for the best way to do a simple instr()

(find a substring in a string)...





- David Brophy

Director, Cambro Limited,

(023) 80 679550 

daveb@c...



---

Message #18 by "Fredrik Normen" <fredrik.normen@e...> on Wed, 11 Oct 2000 08:51:33 +0100
For beta2 (note: this change is not in the beta1 release that will be

released shortly), we plan to modify the template syntax to simply be a

direct sub-tag of a parent control.  The element name of the tag would

then

be the name of the template.



So, instead of:



<asp:datalist id="MyList" runat=server>



   <template name="ItemTemplate">

       Foobar.....

   </template>



</asp:datalist>



you would just write:



<asp:datalist id="MyList" runat=server>



   <ItemTemplate>

       Foobar.....

   </ItemTemplate>



</asp:datalist>



The "ItemTemplate" tag itself doesn't have a runat=server attribute since

it

itself is not a control -- but rather a template definition.  As such, you

never directly program against it -- but rather an instance of it that a

control optionally creates at runtime.



- Scott



/Fredrik Normen



Message #19 by David Brophy <daveb@c...> on Wed, 11 Oct 2000 09:17:49 +0100
On Mon, 9 Oct 2000 13:05:15 +0200, you wrote:



>David, this is not a problem.

>

>With functions generating HTML it sould be best to restructure them into

>Pagelets, though NOT on a 1:1-base.

>

>I had a similar "problem": 2 functions to create a "frame" around

>content. They became one Pagelet that wraps the content in the form

>

><start>

>        content here

></start>

>

>Make good use of this.





OK - I give up - spent hours trying to find where this feature is

documented/explained - can you help?





- David Brophy

Director, Cambro Limited,

(023) 80 679550

daveb@c...

Message #20 by "Anders Lundholm" <lundholm@s...> on Wed, 11 Oct 2000 14:49:58 +0200
Hello!



>With functions generating HTML it sould be best to restructure them into

>Pagelets, though NOT on a 1:1-base.



I have found that designing HTML in a function (that is, concatenating a

string with different HTML tags and so forth) isn't very fast (especially

not in regular ASP, which I've used so far) but actually very flexible.



I often keep all the functionality (except re-usable functions) in a

standard page (a module) - with all the layout and logic. By having the

layout as functions, I could display different parts of the page depending

upon what the user has done. And VERY different layouts too - not just

different text parts in static positioned label-controls.



Like this:

If User Has Clicked 'Send Password' Then

    Display SendPasswordForm

ElseIf User Has Clicked 'Register User' Then

    Display ShowComplexHTMLForm

Else

    Display StandardLogin

End If



Is that possible? Like displaying different pagelets (or User Controls)

depending upon what a user has been clicking on a page?!



Like this:

@register 3 pagelets (or one pagelet with everything in it).



If User Has Clicked 'Send Password' Then

    Pagelet-in-seperate-file called SendPasswordForm

ElseIf User Has Clicked 'Register User' Then

    Pagelet-in-seperate-file called ShowComplexHTMLForm

Else

    Pagelet-in-seperate-file called StandardLogin

End If



As far as I'm concerned, Pagelets (or User Controls) are supposed to offer

standard HTML to be interpreted along with any <SCRIPT> code you may have.

Just like it's a function which wraps HTML around functions. A 'Code Behind'

class written in C# won't allow that, unless you have a function which

specifically contatenates HTML as a string and returns that very string.



Then, when having registered the namespace (roughly), you could access parts

of the page (or call it 'visual functionality')



using MyObjects.ClassLibrary;

response.write(ClassLibrary.GetForm(intUserId));



>I had a similar "problem": 2 functions to create a "frame" around

>content. They became one Pagelet that wraps the content in the form

><start>

>content here

></start>



I didn't get that one, however! Could you please explain a bit more about

that paragraph?



Thanks in advance!



with regards

anders lundholm · lundholm@s...

the sphereworx / monoliner experience

--






  Return to Index