/// Hide link and add text control
/// </summary>
/// <param name="cell"></param>
/// <param name="nullDisplayText"></param>
public static void DataControlField_SetNullDisplayText(DataControlFieldCell cell, string nullDisplayText)
{
//TODO: implement derived from HyperLinkField class and set nullDisplayTex property
// TableCell cell = (TableCell) control;
Debug.Assert((cell.ContainingField is HyperLinkField) || (cell.ContainingField is ButtonField));//
if(cell.ContainingField is HyperLinkField)
{
if (((cell.Controls.Count < 1) || !(cell.Controls[0] is HyperLink)))
{
throw new ApplicationException("HyperLinkField_WrongControlType"+ cell.ToString());
}
HyperLink link = (HyperLink)cell.Controls[0];
link.Visible = false;
}
if(cell.ContainingField is ButtonField)
{
if (((cell.Controls.Count < 1) || !(cell.Controls[0] is LinkButton)))
{
throw new ApplicationException("ButtonField_WrongControlType" + cell.ToString());
}
LinkButton link = (LinkButton)cell.Controls[0];
link.Visible = false;
}
Label label = new Label();
label.Text = nullDisplayText;
label.Visible = true;
cell.Controls.Add(label);
}