Here is a rather useful control, the UpdatePanel control, that will allow you to perform a partial render of a web page after a postback is performed. So what does partial render do and why is it useful?
To answer those questions, I'll need to give you a brief description of how the typical postback process occurs:
- Client browser contacts Server via URL
- Server sends information about the construction of the entire web page to the client
- Client renders the web page on the user's screen
- User inputs information into textbox controls and clicks a button to initiate a postback event
- Client sends information to the Server for processing
- Server processes information
- Server sends back information about the construction of the entire web page
So what's the problem?
Well, after the user has clicked a button and initiated a postback event, the page is, essentially, frozen until the server sends back info to the client and the browser rebuilds/renders the web page. This means that any additional information that the user types into the web page will be wiped out once the page is rendered (that is, unless it is being trapped and rebuilt via Viewstate). Also, the screen will flash and the browser will reset back to the top of the page once the rendering process is complete (this can be remedied via SmartNavigation; however, that won't work if your client's browser isn't compatible).
Here is a perfect situation where partial rendering would be invaluable:
- You want the server to validate/process some user-supplied information while the user continues to enter more information on the page
- You don't want the user's new information to be wiped out once the server has completed processing of the data and provided status
- You want the postback to be as seamless as possible (i.e. no flickering or resetting the position of the web page)
In order to enable such functionality on your Atlas web page, you only need to add a few elements to an Atlas-enabled web page shown as follows:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<div>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
... Control that initiates Postback ...
... Controls that need to be modified after Postback finalizes ...
</ContentTemplate>
</asp:UpdatePanel>
</div>
The addition of this code between the appropriate asp controls located in the <Form> tag will now allow you to carry out asynchronous processing while the user continues to work with the web page. Essentially, the only information that will be sent back to the client after the server completes its processing will be the changes to the controls specified in the <UpdatePanel> tags (i.e. such as a label control that tells your user how the validation effort went). That's it! This, of course, gives the added bonus of using less network bandwidth on that last part of the client/server communication (the return of data back to the client after the server has processed its data) since you don't have to have the entire page rebuilt/rendered on the return trip. Pretty cool stuff, eh? Give it a shot and let me know if you need a sample to work with.