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
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
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
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
Hi Randal,
Thank you for the fast response! If everything is clear I will close thе thread.
Regards,
Petar
Progress Telerik