This is a migrated thread and some comments may be shown as answers.

Deriving new event handler for onselectionchanged

4 Answers 179 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
G S S
Top achievements
Rank 1
G S S asked on 16 Apr 2009, 10:13 PM

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

4 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 17 Apr 2009, 07:17 AM
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.
0
G S S
Top achievements
Rank 1
answered on 18 Apr 2009, 12:19 AM

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

0
Atanas Korchev
Telerik team
answered on 20 Apr 2009, 11:56 AM
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.
0
G S S
Top achievements
Rank 1
answered on 21 Apr 2009, 08:35 PM
Thanks for that :)
Tags
ComboBox
Asked by
G S S
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
G S S
Top achievements
Rank 1
Share this question
or