Deriving new event handler for onselectionchanged

5 posts, 0 answers
  1. G S S
    G S S avatar
    12 posts
    Member since:
    Sep 2007

    Posted 16 Apr 2009 Link to this post

    Hi,

    I am designing an RSS Feed reader using a RAD Grid and RAD Combo box.

    My combo box will list all the sites whose feeds I subscribe to (e.g. this site, MSDN, etc etc).

    On the selection of a feed, I want to fire an event handler (implemented) but I want to get the corresponding feed URL of a site title (using my dictionary collection in C#).

    However, you cannot add new parameters to an event handler unless you override it.

    This raises confusion for me. I have an event which is derived from RADComboBox... (can't remember exact name), and I've added the extra field in the derived constructor.

    However, when I call the event handler at onSelectionChanged, I get this error:

    Error 5 No overload for 'NewEventHandler' matches delegate 'Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventHandler' 

    Code:

    public class NewEventHandler : Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs
    {
    public string Url;

    public NewEventHandler(string text, string oldtext, string value, string oldValue, string Url) : base(text, oldtext, value, oldValue)
    {
    }
    }

    I then call this event handler on the appropriate/relevant event, and pass in the parameters in the constructor of the event handler, like so:

      onselectedindexchanged="NewEventHandler"

      protected void NewEventHandler(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e, string Url)
    {

    What am I doing wrong?

    Thanks

  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 17 Apr 2009 Link to this post

    Hello G S S,

    You cannot assign your type of event handler to the SelectedIndexChanged event as they are of different type. What you should do is expose a new event by inheriting from RadComboBox. Then subscribe to the OnSelectedIndexChanged event and raise your event there.

    Regards,
    Albert
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. G S S
    G S S avatar
    85 posts
    Member since:
    Mar 2008

    Posted 17 Apr 2009 Link to this post

    Is there an example of this (Either in general ASP.NET or in specific to rad controls)?

    I ask, because I don't have much experience modifying event functionality.

    Thanks

  5. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 20 Apr 2009 Link to this post

    Hello G,

    I have attached a sample web site which demonstrates the required approach.

    I hope this helps,
    Albert
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. G S S
    G S S avatar
    85 posts
    Member since:
    Mar 2008

    Posted 21 Apr 2009 Link to this post

    Thanks for that :)
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017