用户表 内容表Id | name | Depaer || IDepartID | DepaerName | DepaerOpp ||其中 Depaer=IDepartID我的方法 protected void gvDepartMain_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)//判断行类型
{
string gvId = GridView1.DataKeys[e.Row.RowIndex].Value.ToString();//得到部门id
DepartInfo ev = DepartManager.GetDepartByID(gvId);
UserInfo user = (UserInfo)Session["CurrentUser"]; string userdepar=ev.IDepartID.Substring(0, 2); if (userdepar ==user.Depaer)
{
e.Row.Cells[0].Text = ev.VcDepartName;
e.Row.Cells[1].Text=ev.DepaerOpp }
else
{
e.Row.Visible = false;
}
}
}行数显示 8行。 内容表里总共有33行数据我在读取GridView的值时,
for (int i = 0; i < gvDepartMain.Rows.Count; i++)
{ }gvDepartMain.Rows.Count=33.
我该怎么改
{
if (e.Row.RowType == DataControlRowType.DataRow)//判断行类型
{
string gvId = GridView1.DataKeys[e.Row.RowIndex].Value.ToString();//得到部门id
DepartInfo ev = DepartManager.GetDepartByID(gvId);
UserInfo user = (UserInfo)Session["CurrentUser"]; string userdepar=ev.IDepartID.Substring(0, 2); if (userdepar ==user.Depaer)
{
e.Row.Cells[0].Text = ev.VcDepartName;
e.Row.Cells[1].Text=ev.DepaerOpp }
else
{
e.Row.Visible = false;
}
}
}行数显示 8行。 内容表里总共有33行数据我在读取GridView的值时,
for (int i = 0; i < gvDepartMain.Rows.Count; i++)
{ }gvDepartMain.Rows.Count=33.
我该怎么改
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货