Archive for September, 2011
Asp.Net: DataPager problem with Listview
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { bind(); } } private void bind() { SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\NORTHWND.MDF;Integrated Security=True;User Instance=True"); DataSet ds = new DataSet(); SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM [Region]", con); sda.Fill(ds); this.lvItems.DataSource = ds.Tables[0]; lvItems.DataBind(); } protected void lvItems_PagePropertiesChanging(object sender, PagePropertiesChangingEventArgs e) { this.DataPager1.SetPageProperties(e.StartRowIndex, e.MaximumRows, false); bind(); }