0
后显示在GridView中的列行数(仅可见行)这是我的前端代码:如何隐藏某一行
<asp:TemplateField HeaderText="NO.">
<ItemTemplate ><div ID="PicCounter" style="text-align: center; color:black"><%# Container.DataItemIndex + 1 %></div></ItemTemplate>
</asp:TemplateField>
虽然,这是我的后端代码:
int sum = 0;
protected void gv_Action_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label Action = (Label)e.Row.FindControl("ACTION");//take lable id
if (Action.Text.ToString() == "0")
{
e.Row.Visible = false;
}
else if (Action.Text.ToString() != "")
{
sum += int.Parse(Action.Text);
lblTotalNoti.Text = sum.ToString();
}
}
}
catch (Exception ex)
{
Log.Write("gv_Action_RowDataBound() Error: " + ex.Message.ToString() + ex.StackTrace.ToString());
ERRORMSG.Text = "gv_Action_RowDataBound() Error: " + ex.Message.ToString();
}
}
我想隐藏一些行后,在网格视图的一列中的每个可见行的行编号。我的问题是我隐藏的行也得到了编号。请帮助我,我是初学者。
? – Krishna