protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "")
{
datacon1.OLEformpk(GridView1, "select * from View_course_profession order by courseid", "courseid");
}
else
{
datacon1.OLEform(GridView1, "select * from View_course_profession where" + DropDownList1.SelectedValue + "like '%" + TextBox1.Text + "%'");
}
}
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
datacon1.OLEform(GridView1, "select * from View_course_profession where" + DropDownList1.SelectedValue + "like '%" + TextBox1.Text + "%'");
}
}
如何选择DropDownList1中的值,在gridview中显示相应的内容?比如我选择...
先检查dropdownlist的autopostback属性是否为true,然后加断点,取出sql语句放到sql server里查询是否有返回值,如果在sql server里有返回值,则检查gridview绑定是否出错 if (str == "171"){ \/\/这里可以不用再次连接数据库了 string sql=string.format("SELECT xsk_{0}.xh as 学号,xsk_{0}.xm as ...
运行是总是出现错误:dropdownlist1有一个无效 SelectedValue,因为它...
如果你的数据库中a_code字段的值总不为null的话,你的程序是没有问题的。因为在数据绑定时为DropDownList提供了所有合适的SelectedValue。但是当a_code字段的值为null时,就会出错了,因为SelectedValue不能为null。有两种解决方法,一是修改你的数据库,让a_code这一列为能为空。还有一种方法就是改一下...
急。请教ASP C#中GridView出现的问题,谢谢各位大大,高分~求答案~谢谢...
+ ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text.ToString().Trim() + "',姓名'" + ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text.ToString().Trim() + "',性别='" + ((TextBox)(GridView1.Rows[e.RowIndex].Cells[3].Controls[0])).Tex...