Overloading a return value to a property in a webcontrol. Ambiguous Match Found Error.
-
I'm creating a CustomGridView based (of course) on the GridView. I'm writen my on PagerProperties with a diferent class and diferent properties. Everything works ok with the default values but if I set any value I receive the "Ambiguous Match Found" error. Here is a sample code of what is happening:
public sealed class MyPagerSettings : IStateManager {
...
[Category("Appearance")]
[DefaultValue(true)]
[NotifyParentProperty(true)]
public bool Visible {
get { return (bool?)mViewState["Visible"] ?? true; }
set { mViewState["Visible"] = value; }
}...
}public class MyGridView : GridView {
...
MyPagerSettings mPagerSettings; \[Category("Paging")\] \[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)\] \[NotifyParentProperty(true)\] \[PersistenceMode(PersistenceMode.InnerProperty)\] `new` public virtual MyPagerSettings PagerSettings { get { if (mPagerSettings == null) { mPagerSettings = new MyPagerSettings(this); if (IsTrackingViewState) ((IStateManager)mPagerSettings).TrackViewState(); } return mPagerSettings; } }
...
}
The new modifier should hide the base property. On the consuming page:
<awc:MyGridView ID="MyGridView1" runat="server" AllowPaging="True" PageSize="10"> `<PagerSettings Visible=false /> <-- The error happens here!` <Columns>
...
</Columns>
</awc:MyGridView>Please any help on how to work around it? Please... I don't want to change the name of the property!!! So no obvious answers please. Thanks.