jueves, 30 de julio de 2009

Desahabilitar Controles

private void DisableControls(Control c,bool habilita)
{

if ((c is WebControl) && (c.GetType().Name != "TabPanel") && (c.GetType().Name != "Panel") && (c.GetType().Name != "GridView"))
((WebControl)c).Enabled = habilita;

if ((c is WebControl) && (c.GetType().Name == "ImageButton"))
((WebControl)c).Visible = habilita;

if ((c is WebControl) && (c.GetType().Name == "GridView") && (c.ID == "gvCtrTramitesTracto"))
((GridView)c).Columns[7].Visible = habilita;

foreach (Control child in c.Controls)
DisableControls(child,habilita);
}

No hay comentarios:

Publicar un comentario