The next task is to add an UpdatePanel Control to the page. The
UpdatePanel Control is responsible for converting the server postback to the client
side postback. Any control placed inside the UpdatePanel Control automatically
uses the client postback. In other words, all you need to do is add an
UpdatePanel to the page and place the GridView inside the UpdatePanel. Take a
look at the code below.
Listing 3 – GridView inside the Update Panel
control
<atlas:UpdatePanel ID="up1" runat="server">
<ContentTemplate>
<asp:GridView ID="gvContacts" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" BackColor="White"
BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"CellPadding="4"
DataSourceID="SqlDataSource1"ForeColor="Black" GridLines="Vertical" >
<FooterStyle BackColor="#CCCC99"/>
<Columns>
<asp:CommandFieldShowSelectButton="True" />
<asp:BoundField DataField="Name"HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Address"HeaderText="Address"
SortExpression="Address" />
</Columns>
<RowStyle BackColor="#F7F7DE" />
<SelectedRowStyle BackColor="#CE5D5A"Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#F7F7DE"ForeColor="Black" HorizontalAlign="Right" />
<HeaderStyle BackColor="#6B696B"Font-Bold="True" ForeColor="White" />
<AlternatingRowStyleBackColor="White" />
</asp:GridView>
</ContentTemplate>
</atlas:UpdatePanel>
Analysis
The UpdatePanel Control is the part of the Atlas framework. I
moved the GridView inside the Update Panel’s ContentTemplate tag. Now if you
run your application, you will notice that all the events generated by the
GridView are handled on the client side and no server postback occurs.