Copy Code code as follows:
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 ();";
}
Delete Column
LinkButton Btndelete = (LinkButton) e.item.findcontrol ("Btndelete");
No permission was removed and the control was found
if (!bcandelete && btndelete!= null)
{
Find the cell column number where the control is located
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
}
}
}
}
}