Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: FW: Re: Webforms and multiple pages


Message #1 by Robert Seber <robert.seber@n...> on Mon, 6 Aug 2001 10:08:12 +0100
Ben, instead of inheriting your code-behind class from Page you just need 
to put all your code that is common to each page in a class that you write 
that derived from Page and then have your code-behind pages derive off 
your class.

>I am still confused in light of this how you are supposed to use the code 
>behind pages...a seperate class for every page seems silly because many 
>pages contain the same elements and you dont want to rewrite these 
>elements 
>for each class. I was a big fan of include structures but with codebehind 
>iam not sure how these fit in.

>I find myself repeating code in classes in codebehind pages and also in 
>the 
>aspx pages. you can only have one server side form per page also which is 
>a 
>limitation becuase although you can have multiple input elements and 
>buttons 
>the 'enter' button will default to the first element on the form. so when 
>the user hits enter it will submit the first 'virtual form' even thought 
>the 
>users focus is on another one.

>any ideas?

>Ben

>ps doesnt a seperate class for each page negate code reusability or can 
>you 
>import multiple classes from the same namespace



  Return to Index