I have really a problem with gridview..i have a dropdownlist..which on select..sets the page sie of the grid view..but for unknown reason..it is not working properly..for example when i change it ..it doesnot work properly..can somebody help me..

public partial class ThmbListing : System.Web.UI.UserControl
{

#region Fields ------------------------------------------------------------------------

public DataSet ds = new DataSet();
public DataTable myPropertyTable = new DataTable();
public Icon icon;
//private int pagesize = 5;

#endregion


#region Public properties

/*
public int PageSize
{
get
{
return this.pagesize;
}
set
{
this.pagesize = value;
this.GridView1.PageSize = value;

}
}

*/
#endregion

#region Public Protected Methods


public void MyDataBind()
{

this.icon = new Icon();
SqlConnection cn = new SqlConnection();
cn.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["DBConnectionString"];
SqlDataAdapter da = new SqlDataAdapter("select * from ResidentialListingView", cn);
da.Fill(ds);
this.GridView1.PageSize = Convert.ToInt32(ViewState["SizePage"]);
GridView1.DataSource = this.ds;
Label1.Text = Convert.ToString(ViewState["SizePage"]);
//PageSize = Convert.ToInt32(ViewState["SizePage"]);
GridView1.DataBind();
cn.Close();
ds.Dispose();


}

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{

ViewState["SizePage"] = 5;
MyDataBind();

}


}

protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
ViewState["CurrentPage"] = e.NewPageIndex;
GridView1.PageIndex = e.NewPageIndex;
MyDataBind();
}

protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Pager)
{

//int count = GridView1.PageCount * GridView1.PageSize;
//int Totalpropery = this.ds.Tables[0].Rows.Count;
//int startRecrod = 0;
// int endRecrod = 0;

//startRecrod = (GridView1.PageIndex * GridView1.PageSize) + 1;
//if (GridView1.PageIndex + 1 == this.GridView1.PageCount)
// endRecrod = Totalpropery;
//else
// endRecrod = (GridView1.PageIndex + 1) * GridView1.PageSize;
//lblView.Text = "Viewing : <B>" + startRecrod + "</B> - <B>" + endRecrod + "</B> of <B>" + Totalpropery + "</B>";
lblView.Text = GridView1.PageCount.ToString();

}

}

protected void SizeList_SelectedIndexChanged(object sender, EventArgs e)
{
//PageSize = Convert.ToInt32(SizeList.SelectedItem.Value);
ViewState["SizePage"] = SizeList.SelectedItem.Value;
MyDataBind();
}