For qns 1-3
Put the GridView inside a code
div
or a
Panel
control.
1. If you use in
div
<div style="vertical-align top; height: 152px; overflow:auto;width:800px;">
<asp:GridView ID="myGridView" runat="server" AllowPaging="True" AllowSorting="True" OnRowCreated="myGridView_RowCreated">
</asp:GridView>
</div>
2. If you use
Panel
<asp:Panel ID="myGridViewPanel" runat="server" ScrollBars="Vertical">
<asp:GridView ID="myGridView" runat="server" AllowPaging="True" AllowSorting="True" OnRowCreated="myGridView_RowCreated">
</asp:GridView>
</asp:Panel>
For qn 4.
protected void myGridView_RowCreated(object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{
if (myGridView.DataSource != null)
lblRecord.Text = ((IList)myGridView.DataSource).Count.ToString();
}
I hope this will help you well.