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

Cascading dropdownlists in a ViewComponent binding question

5 Answers 259 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
BitShift
Top achievements
Rank 1
Veteran
BitShift asked on 03 Nov 2019, 01:11 AM

Im implementing a ViewComponent in a RazorPages application that includes two dropdownlists.  The primary would be returned with the initial view, the 2nd would be called via ajax.

Questions:
- Does the ViewComponent even need a model if I am using using a method in my VC to return data for the primary dropdown?
- If using using RazorPages, what is the syntax for the DataSource read action, which expects an MVC controler name and action?
Since the controller name is the name of the viewcomponent in this case and action would be something like "Handlers?handler=MyMethod

5 Answers, 1 is accepted

Sort by
0
Petar
Telerik team
answered on 07 Nov 2019, 06:56 AM

Hi,

Please check the attached project for the DataSource syntax of the read method. 

Regarding your first question, I am not sure I understand the scenario with the DropDownLists. Can you provide an example project on which we can discuss the case?

Regards,
Petar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
BitShift
Top achievements
Rank 1
Veteran
answered on 07 Nov 2019, 08:32 PM

Thanks Petar, I posted in the Genderal Discussion thread about my approach.  I have it figured out now.
Just a matter of getting up to speed.  I was stuck on getting my head around ViewComponents.  
Long story short - to do what I asked above involves:
(1) A viewcomponent with 2 Kendo DropDownList's.  Call them 1st and 2nd.
The 1st DDL loads from calling a method in a class library and uses model binding.
Attach a jquery Select event for this DDL
When a user selects an item, the Select event calls an api endpoint which returns json

(2) This DDL, set its DataSource to empty, eg.  .DataSource( s=> { })
Then, the event which returns json data, find the 2nd DDL, get its DataSource and fill it

 

0
Petar
Telerik team
answered on 12 Nov 2019, 02:32 PM

Hi Randal,

I can see from this forum thread that Dimitar has helped you clear the questions around the ViewComponents. 

Do you still need help with the implementation of the scenario with the DDLs?

Regards,
Petar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
BitShift
Top achievements
Rank 1
Veteran
answered on 12 Nov 2019, 03:34 PM
No, I got it now thanks.
0
Petar
Telerik team
answered on 13 Nov 2019, 09:54 AM

Hi Randal,

Thank you for the fast response! If everything is clear I will close thе thread. 

Regards,
Petar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DropDownList
Asked by
BitShift
Top achievements
Rank 1
Veteran
Answers by
Petar
Telerik team
BitShift
Top achievements
Rank 1
Veteran
Share this question
or