Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Overloading a return value to a property in a webcontrol. Ambiguous Match Found Error.

Overloading a return value to a property in a webcontrol. Ambiguous Match Found Error.

Scheduled Pinned Locked Moved C#
helpquestionsysadminregextutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Andre Vianna
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups