Hiding/disabling LinkButtonField in a specific Row of Grid

Nov 12, 2010 at 11:38 AM

Hello,

how can I hide or disable LinkButton in a specific (current) Row from RowCommand() or RowDataBound()?

Dec 2, 2010 at 7:11 AM

U can check below example:

protected
void grTargetContent_PreRowDataBound(object sender, ExtAspNet.GridPreRowEventArgs e) { ExtAspNet.LinkButtonField imageField = grTargetContent.FindColumn("lbfAction1") as ExtAspNet.LinkButtonField; ExtAspNet.LinkButtonField imageField3 = grTargetContent.FindColumn("lbfAction3") as ExtAspNet.LinkButtonField; //ExtAspNet.WindowField windowField = Grid1.FindColumn("myWindowField") as ExtAspNet.WindowField; DataRow row = e.DataItem as DataRow; string style = String.Empty; if ((int)row[2] != 0) { imageField3.Text = "Edit"; imageField.Text = "Delete"; imageField3.CommandName = "Edit"; imageField.CommandName = "Delete"; style = "color:black;font-weight:normal;"; } else { imageField3.Text = "Add"; imageField.Text = ""; imageField3.CommandName = "Add"; imageField.CommandName = ""; style = "color:#E41B17;font-weight:bold;"; } foreach (ExtAspNet.GridColumn column in grTargetContent.Columns) { ExtAspNet.BoundField field = column as ExtAspNet.BoundField; if (field != null) { field.DataFormatString = "<span style=\"" + style + "\" title=\"" + row[1] + "\">{0}</span>"; field.DataTooltipField = "TARGET_NAME"; } } }