最佳答案
可能您在 第一次 填充 gridview 之前没有检查 IsPostBack
属性。试试这个:
首先,用一个方法包装您第一次填充的 gridview:
private void PopulateGridview()
{
string cmdstr= "SELECT DriverID,DriverEmail,Availability FROM tblDriver";
gv1.DataSource = getall(cmdstr,con);
gv1.DataBind();
}
现在,以这种方式在 Page_Load()
中调用它:
protected void Page_Load()
{
if(!IsPostBack)
{
PopulateGridview();
}
}
关于c# - GridView LinkButton 在 C# 中搜索后不更改 CommandArgument 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34093728/