富贵资源网 Design By www.hznty.com
复制代码 代码如下:
protected void dgQuery_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if ((e.Item.ItemType != ListItemType.Header) && (e.Item.ItemType != ListItemType.Footer))
{
DataRow drRow = ((DataRowView)e.Item.DataItem).Row;
string commonPartId = drRow["cniBackup1"].ToString();
HyperLink hlTrans = (HyperLink)e.Item.FindControl("hlTrans");
if (hlTrans != null)
{
hlTrans.Text = "--";
hlTrans.NavigateUrl = "javascript:void();";
}
//删除列
LinkButton btnDelete = (LinkButton)e.Item.FindControl("btnDelete");
//没有删除权限且找到控件
if (!bCanDelete && btnDelete != null)
{
//查找控件所在Cell列号
for (int i = 0; i < e.Item.Cells.Count; i++)
{
if (e.Item.Cells[i].HasControls() && e.Item.Cells[i].Controls.IndexOf(btnDelete) > 0)
{
int index = e.Item.Cells[i].Controls.IndexOf(btnDelete);
e.Item.Cells[i].Controls.RemoveAt(index);
Literal tips = new Literal();
tips.Text = "--";
e.Item.Cells[i].Controls.AddAt(index, tips);
//e.Item.Cells[i].Text = "--";
break;
}
}
}
}
}
protected void dgQuery_ItemDataBound(object sender, DataGridItemEventArgs e)
{
if ((e.Item.ItemType != ListItemType.Header) && (e.Item.ItemType != ListItemType.Footer))
{
DataRow drRow = ((DataRowView)e.Item.DataItem).Row;
string commonPartId = drRow["cniBackup1"].ToString();
HyperLink hlTrans = (HyperLink)e.Item.FindControl("hlTrans");
if (hlTrans != null)
{
hlTrans.Text = "--";
hlTrans.NavigateUrl = "javascript:void();";
}
//删除列
LinkButton btnDelete = (LinkButton)e.Item.FindControl("btnDelete");
//没有删除权限且找到控件
if (!bCanDelete && btnDelete != null)
{
//查找控件所在Cell列号
for (int i = 0; i < e.Item.Cells.Count; i++)
{
if (e.Item.Cells[i].HasControls() && e.Item.Cells[i].Controls.IndexOf(btnDelete) > 0)
{
int index = e.Item.Cells[i].Controls.IndexOf(btnDelete);
e.Item.Cells[i].Controls.RemoveAt(index);
Literal tips = new Literal();
tips.Text = "--";
e.Item.Cells[i].Controls.AddAt(index, tips);
//e.Item.Cells[i].Text = "--";
break;
}
}
}
}
}
富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com
暂无评论...