c# gridview绑定数据源的问题?有大神么,很简单的问题
C#gridview中绑定了一个数据源,然后添加搜索按钮,事件里重建一个DATASET,然后绑定它,但是删除按钮里读取gridview1.count就是0了,一开始是读取...
C# gridview中绑定了一个数据源,然后添加搜索按钮,事件里重建一个DATASET,然后绑定它,但是删除按钮里读取gridview1.count就是0了,一开始是读取到原本第一个数据源的个数,这是为什么,我不是换绑了数据源么
展开
展开全部
SqlDataSource sqlDataSource1 = new SqlDataSource
("server=(local);uid=sa;pwd=1234qwer;database=project;", "select * from Student");
SqlDataSource sqlDataSource2= new SqlDataSource
("server=(local);uid=sa;pwd=1234qwer;database=project;", "select * from Score");
protected void Button1_Click(object sender, EventArgs e)
{
girdview1.DataSource = sqlDataSource1;
girdview1.DataBind();
}
protected void Button2_Click(object sender, EventArgs e)
{
girdview1.DataSource = sqlDataSource2;
girdview1.DataBind();
}
("server=(local);uid=sa;pwd=1234qwer;database=project;", "select * from Student");
SqlDataSource sqlDataSource2= new SqlDataSource
("server=(local);uid=sa;pwd=1234qwer;database=project;", "select * from Score");
protected void Button1_Click(object sender, EventArgs e)
{
girdview1.DataSource = sqlDataSource1;
girdview1.DataBind();
}
protected void Button2_Click(object sender, EventArgs e)
{
girdview1.DataSource = sqlDataSource2;
girdview1.DataBind();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询