views:

95

answers:

3

I have an ASP.net webforms app that connects to a web service, All the functionality is on one page that has lots of difference states and I use a multi view to display the correct html depending on the current state.

The problem is the page is huge and unweildly. The code behind isn't so bad but the aspx page is just out of control.

I would like to have a seperate page for each possible state but can't find a good way to move and pass data between pages. Are there any patterns or practices that I can implement that can help with this? And if having a page for each state is not the way to go what else can I do?

I have to stick with the webforms platform :( so i can't move to MVC.

+2  A: 

You could create a custom control for each of your states and then programmatically instantiate the appropriate control and populate the properties at runtime.

Lazarus
+3  A: 

You need to look into Cross Page Posting. This will allow you to postback to a different url and still have access to the previous page's controls. It will make the separation of your different views much easier to manage.

TheTXI
+1  A: 

Use user controls or custom controls to reduce the page weight and improve maintainability of your web forms.

aleemb