gpt4 book ai didi

c# - GridView LinkBut​​ton 在 C# 中搜索后不更改 CommandArgument 的值

转载 作者:行者123 更新时间:2023-11-30 23:32:59 24 4
gpt4 key购买 nike

我发现了一个类似的问题:gridview linkbutton CommandArgument value not changing

最佳答案

可能您在 第一次 填充 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 LinkBut​​ton 在 C# 中搜索后不更改 CommandArgument 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34093728/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com