GridView的操作:基本操作(翻页、选择)
GridView的基本操作:翻页 事件:PageIndexChanging
1protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
2{
3GridView1.PageIndex = e.NewPageIndex;
4GridView1.DataBind();
5}
6}
GridView的基本操作:选择 事件:SelectedIndexChanging
2{
3GridView1.PageIndex = e.NewPageIndex;
4GridView1.DataBind();
5}
6}
1protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
2{
3TextBox3.Text = GridView1.Rows[e.NewSelectedIndex].Cells[0].Text;
4TextBox4.Text = GridView1.Rows[e.NewSelectedIndex].Cells[1].Text;
5TextBox2.Text=GridView1.Rows[e.NewSelectedIndex].Cells[2].Text;
6CachePic=GridView1.Rows[e.NewSelectedIndex].Cells[3].Text;
7CacheSort = GridView1.Rows[e.NewSelectedIndex].Cells[4].Text;
8}//这里不需要重新绑定
2{
3TextBox3.Text = GridView1.Rows[e.NewSelectedIndex].Cells[0].Text;
4TextBox4.Text = GridView1.Rows[e.NewSelectedIndex].Cells[1].Text;
5TextBox2.Text=GridView1.Rows[e.NewSelectedIndex].Cells[2].Text;
6CachePic=GridView1.Rows[e.NewSelectedIndex].Cells[3].Text;
7CacheSort = GridView1.Rows[e.NewSelectedIndex].Cells[4].Text;
8}//这里不需要重新绑定