2010-11-30 68 views

Répondre

1

Vous pouvez utiliser as à la place:

T AddControl<T>() where T : WebControl, new() { 
    T ctrl = new T(); 
    Label label = ctrl as Label; 
    if (label != null) 
    { 
     label.Text = "FirstName :"; 
    } 
    return ctrl; 
}