I get an "The type 'System.Web.UI.UserControl' has no event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michel

    I get an "The type 'System.Web.UI.UserControl' has no event

    Hi all,


    I just created a new usercontrol, which basicly display's a
    dropdowlist.
    For this control, I created the a new SelectedIndexCh anged event to
    raise the SelectedIndexCh anged event of the dropdowlist to the parent.

    This all runs fine, but every time I open a page which contains my
    control, I get an "The type 'System.Web.UI. UserControl' has no event
    named 'SelectedIndexC hanged'" on the line (in the parent) where I hook
    the event :
    this.mycontrol. SelectedIndexCh anged += new
    System.EventHan dler(this.mycon trol_SelectedIn dexChanged);

    Anyone who has an idea why?


    Thanks,

    M.
  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: I get an "The type 'System.Web.UI. UserControl' has no event

    Michel,

    It looks like myControl is a reference to the base type, UserControl,
    and not to your type. Otherwise, the error would give your type name. Are
    you sure that you are trying to add the event handler to a reference of the
    correct type?

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - nick(dot)paldin o=at=exisconsul ting<dot>com

    "Michel" <michel_mathijs sen@hotmail.com > wrote in message
    news:ab82e040.0 310080125.3277b d67@posting.goo gle.com...[color=blue]
    > Hi all,
    >
    >
    > I just created a new usercontrol, which basicly display's a
    > dropdowlist.
    > For this control, I created the a new SelectedIndexCh anged event to
    > raise the SelectedIndexCh anged event of the dropdowlist to the parent.
    >
    > This all runs fine, but every time I open a page which contains my
    > control, I get an "The type 'System.Web.UI. UserControl' has no event
    > named 'SelectedIndexC hanged'" on the line (in the parent) where I hook
    > the event :
    > this.mycontrol. SelectedIndexCh anged += new
    > System.EventHan dler(this.mycon trol_SelectedIn dexChanged);
    >
    > Anyone who has an idea why?
    >
    >
    > Thanks,
    >
    > M.[/color]


    Comment

    • Michel Mathijssen

      #3
      Re: I get an &quot;The type 'System.Web.UI. UserControl' has no event

      Hi Nicholas,

      I've been thinking about that too, but I have no idea what could be
      wrong.

      I dragged the control onto the page in the design, and added a
      declaration for my web user control in the code behind :

      protected MyControlDropDo wn mycontrol;

      In the InitializeCompo nent I put the line on which he say's their is a
      problem.

      this.mycontrol. SelectedIndexCh anged += new
      System.EventHan dler(this.mycon trol_SelectedIn dexChanged);

      The strange part is that I can run without a problem. Only when I open
      the html page on which I put the control, I get this message.



      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      Working...