我在 ma 网站上有一个长的 GridView 控件。它允许行选择。问题是,当我向下滚动此 GridView 并选择一些底部行时,会发生选择,但整个 GridView 正在滚动回顶部。
我参考此链接来解决我的问题,但无法在 GridView 控件中找到任何属性。我也在msdn Link上搜索。
请指导我这个属性在哪里以及如何解决我的问题。基于下面的复选框事件,我选择了该行。选中复选框后启用删除和编辑按钮。
protected void ChkChanged_Click(object sender, EventArgs e)
{
int count = 0;
foreach (GridViewRow gr in grdProducts.Rows)
{
CheckBox chkGrd = ((CheckBox)gr.FindControl("CheckBox2"));
ImageButton editbutton = gr.FindControl("btnEdit") as ImageButton;
ImageButton deleteButton = gr.FindControl("btnDeleted") as ImageButton;
if (chkGrd.Checked)
{
count++;
editbutton.Visible = true;
deleteButton.Visible = true;
if (count > 1)
break;
}
else
{
editbutton.Visible = false;
deleteButton.Visible = false;
}
}
if (count > 1)
{
foreach (GridViewRow gr in grdProducts.Rows)
{
CheckBox chkGrd = ((CheckBox)gr.FindControl("CheckBox2"));
ImageButton editbutton = gr.FindControl("btnEdit") as ImageButton;
ImageButton deleteButton = gr.FindControl("btnDeleted") as ImageButton;
if (chkGrd.Checked)
{
editbutton.Visible = false;
deleteButton.Visible = false;
}
}
DeleteAll.Enabled = true;
}
}