TAILIEUCHUNG - ASP.NET 4 Unleased - p 172

Using Server-Side ASP .NET AJAX ’ Runat=”server” / ’ TextMode=”MultiLine” Columns=”50” Rows=”3” Runat=”server” / From the Library of Wow! | 1684 CHAPTER 38 Using Server-Side AJAX asp UpdatePanel id up1 Runat server ContentTemplate asp FormView id frmFeedback DataSourceId srcFeedback DefaultMode Insert Runat server InsertItemTemplate asp Label id lblName Text Name AssociatedControlID txtName Runat server asp RequiredFieldValidator id valName Text Required ControlToValidate txtName Runat server br asp TextBox id txtName Text Bind Name Runat server br br asp Label id lblComment Text Comment AssociatedControlID txtComment Runat server asp RequiredFieldValidator id valComment Text Required ControlToValidate txtComment Runat server br asp TextBox id txtComment Text Bind Comment TextMode MultiLine Columns 50 Rows 3 Runat server From the Library of Wow eBook Using the UpdatePanel Control 1685 br br asp Button id btnSubmit Text Submit CommandName Insert Runat server InsertItemTemplate asp FormView br br asp GridView id grdFeedback DataSourceID srcFeedback AllowSorting true Runat server ContentTemplate asp UpdatePanel asp SqlDataSource id srcFeedback ConnectionString ConnectionStrings con SelectCommand SELECT Id Name Comment DateSubmitted FROM Feedback InsertCommand INSERT Feedback Name Comment VALUES @Name @Comment Runat server div form body html 38 Because the UpdatePanel control in Listing contains both the FormView and GridView you can interact with the page without performing a single postback. When you submit the form the form data is submitted back to the server using Ajax. When you sort the columns in the GridView the sorted rows are retrieved from the server through an Ajax call. The UpdatePanel control has six important properties ChildrenAsTriggers Gets or sets a Boolean value that indicates whether child controls should trigger an asynchronous postback automatically. From the Library of Wow eBook 1686 CHAPTER 38 Using Server-Side AJAX ContentTemplateContainer Gets the container for the UpdatePanel control s ContentTemplate. You can add controls to the ContentTemplate .