悬赏分:20 浏览:325 次
像发评系统中那样 我做了一个DataList中的控件,在这个控件里有两个按钮 ,修改和删除 (linkbutton)型 ,我想做的操作是:当前登录用户发表的就显示出来 如果不是就隐藏
我在数据绑定后用
DataTable dt = cbll.getComment(cinfo);
if (dt != null && dt.Rows.Count > 0)
{
//判断登录人是否为发布人
UserInfo uinfo = UserBLL.GetLogonInfo();
this.dlcomment.DataSource = dt;
for (int i = 0; i < dt.Rows.Count; i++)
{
if (uinfo.Uid == Convert.ToInt32(dt.Rows[i]["uid"].ToString()))
{
this.dlcomment.Controls[i].FindControl("lkbUpdate").Visible = true;
this.dlcomment.Controls[i].FindControl("lkbDel").Visible = true;
}
else
{
this.dlcomment.Controls[i].FindControl("lkbUpdate").Visible = false;
this.dlcomment.Controls[i].FindControl("lkbDel").Visible = false;
}
}
this.dlcomment.DataBind();
}
但是老是报错
指定的参数已超出有效值的范围。
参数名: index
这该么样解决啊?!
请遇到过此问题的高人指点指点!