On radDropDownList event : SelectedIndexChanged

2 Answers 87 Views
DropDownList
Kobus
Top achievements
Rank 1
Iron
Kobus asked on 19 May 2022, 10:44 PM

Hi.

 

I want to know if there is a way to NOT execute the code in "SelectedIndexChanged" when the form loads the first time

 

Regards

Kobus

 

2 Answers, 1 is accepted

Sort by
0
David
Top achievements
Rank 1
Iron
Iron
Iron
answered on 20 May 2022, 03:56 PM

The solution I use is to bind the event handlers in my code and not to rely on the generated designer code. That is, in my form _Load event I populate the fields on the form, then after that is complete I bind the event handlers.

 

This is actually a pretty easy change to make. You can simply go to the event handler method declaration, and do a global search for that name. This will show you where in the .Designer.cs file it is referenced.  Open that file, cut that line of code, and paste it into your form Load method (or wherever you need it).

 

-David

0
Dinko | Tech Support Engineer
Telerik team
answered on 23 May 2022, 01:25 PM

Hello Kobus,

As David suggested, you could subscribe to the SelectedIndexChanged event of the control at a later stage. You can do that in the Load event of the form or in the Shown event which is called after the first event. 

Give this approach a try and let me know if it is working for you.

Regards,
Dinko
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DropDownList
Asked by
Kobus
Top achievements
Rank 1
Iron
Answers by
David
Top achievements
Rank 1
Iron
Iron
Iron
Dinko | Tech Support Engineer
Telerik team
Share this question
or