Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: ASP.NET: Page flow best practices?


Message #1 by Feduke Cntr Charles R <FedukeCR@m...> on Thu, 30 May 2002 09:30:32 -0400
Aiden,

	Cool.  I ended up combining the flow method I've been using with
what you do, and made an inheritable class that inherits from Page.
Basically it looks for the Request.Form["action"] and QueryString["action"],
and displays a panel based on the action.  The *.aspx turns out looking
like...

top boiler text...
<CT:Flow Action="" RunAt="server">
	Nothing to do!
</CT:Flow>
<CT:Flow Action="save" RunAt="server">
	<p>You clicked on save!</p>
</CT:Flow>
bottom boiler text...

so instead of embedding nasty if ... { } statements in <% and %> tags, I get
a much cleaner HTML page.

	If anyone wants the source code just let me know.

	Thanks!
- Chuck

-----Original Message-----
From: Montgomery, Aiden [mailto:Aiden.Montgomery@f...]
Sent: Thursday, May 30, 2002 9:37 AM
To: ASPX_Professional
Subject: [aspx_professional] RE: ASP.NET: Page flow best practices?


Hello,

The way that I am creating pages which have a lot of functionality on them
is to include the different form in asp:Panel's.
Using LinkButton's as the method for submitting these forms means that you
can specify the event handler for the OnClick.
In these event handlers I simply determine which Panels are visible and
which are not.
That way you can change the order of the logic by changing the order of the
visibility.
I have no idea if this is a good wayto do it, but it works and does not seem
to slow anything down, seeing as though when the Panel is hidden the HTML
for it is not generated.

HTH,

Aiden


-----Original Message-----
From: Feduke Cntr Charles R [mailto:FedukeCR@m...]
Sent: 30 May 2002 14:31
To: ASPX_Professional
Subject: [aspx_professional] ASP.NET: Page flow best practices?


	I'm currently developing a web application using ASP.NET, and since
I started working on it, I've been wondering what the best practices are for
page logic flow.  Coming from standard ASP, I developed my pages where every
form had an "action" hidden field and a "mode" hidden field, and the flow of
the page went like so:

Select Case LCase(sAction)
	Case ""
		' display search form
	Case "search"
		' display search results
	Case "view"
		' display read only view
	Case "add", "edit"
		If LCase(sAction) = "edit" Then
			' get the data
		End If
		' display form for adding or editing
	Case "save"
		' we're doing some data modification
		Select Case LCase(sMode)
			Case "add"
				' INSERT
			Case "edit"
				' UPDATE
			Case "delete"
				' DELETE
		End Select
		' execute SQL command here
		' report errors
End Select

	Now I find myself wanting to implement the same exact flow model in
ASP.NET, but I think that maybe there's a better way.  Multiple pages are
not an option (as this clutters up directories and makes code maintenance
dreadful).  I would like to know what methods you are using on your ASP.NET
projects, and am wondering if there is any type of standard.

Thanks,
- Chuck
		



  Return to Index