How can we do Paging in gridview?
<p>I need to do paging in grid view that actually binds from a list. Can any one please help me out? 
Actually as the data is extracted from a list , am getting "null" while data it is being populated to the next page. So i would like to know whether the users here faced such a criteria.</p>

<p>Method used to bind the grid is as below,</p>

<p><code></p>

<pre><code>private void bindGrid()
 {
if (items != null)
{
foreach (var item in items)
{
name.Add(new organisationName(((System.Xml.XmlElement)((System.Xml.XmlNode[])(item))[7]).InnerText,
((System.Xml.XmlElement)((System.Xml.XmlNode[])(item))[3]).InnerText));
}
searchResultGrid.DataSource = name;
searchResultGrid.DataBind();

}

}
</code></pre>

<p></code></p>

<p>and in the PageIndexChanging event of gridview i used the below code</p>

<p><code></p>

<pre><code>protected void searchResultGrid_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
bindGrid();
searchResultGrid.PageIndex = e.NewPageIndex;
searchResultGrid.DataBind();

}
</code></pre>

<p></code></p>

<p>aspx page
<code></p>

<pre><code>&lt;asp:GridView ID="searchResultGrid" runat="server" PageSize="20" Width="60%" AllowPaging="true"
Visible="False" OnPageIndexChanging="searchResultGrid_PageIndexChanging" OnRowDataBound="searchResultGrid_RowDataBound"
OnSelectedIndexChanged="searchResultGrid_SelectedIndexChanged" OnRowCommand="searchResultGrid_RowCommand"&gt;
&lt;Columns&gt;

&lt;/Columns&gt;
&lt;EmptyDataTemplate&gt;
No Data Found&lt;/EmptyDataTemplate&gt;
&lt;/asp:GridView&gt;
</code></pre>

<p></code>
Thanks in advance</p>
