Here is one way to Overwrite a UserControl.
代码
public class ControlName: DropDownList / Image / button / .......
{
protected override void OnInit(EventArgs e)
{
if (!DesignMode){ ........................ }
base.OnInit(e).
}
}
{
protected override void OnInit(EventArgs e)
{
if (!DesignMode){ ........................ }
base.OnInit(e).
}
}
web.config for imagrate the Class Library Project into website.
<pages validateRequest="false" enableEventValidation="false" viewStateEncryptionMode="Never" enableViewStateMac="false" styleSheetTheme="Theme1">
<namespaces>
<add namespace="**************"/>
</namespaces>
<controls> <add tagPrefix="****" namespace="*********" assembly="********"/> </controls>
<tagMapping>
</tagMapping>
</pages>
<namespaces>
<add namespace="**************"/>
</namespaces>
<controls> <add tagPrefix="****" namespace="*********" assembly="********"/> </controls>
<tagMapping>
</tagMapping>
</pages>