Hello guys. I have created an asp.net core application which in, I have used the RadZen dropdown. everything is ok and the component is rendered successfully but when the user clicks on the item and selects them, I am not able to get the selected values. Here is a brief of my code :
this is the razor file in which the RadZen dropdown exists there.
Without seeing the the full code, it looks like you may be missing the two-way binding requirements.
Have a look at this - Binding with Component Parameters
Unfortunately, the component just accepts @bind-Value for binding selected items not anymore. and I did it, I bonded it exactly with the property that has the [paramater] attribute. I also can get the selected items here <div>Selected values: @string.Join(",", SelectedValues.Select(a=>a.Code))</div> but not in form submitting.
Read the bit about about the EventCallback. Yours will be SelectedValuesChanged (by convention). When it changes in the child component, you invoke the parent method through the EventCallback. In this method, you update the local (parent) SelectedValues variable with the callback parameter.
It's the first example in the link I sent you.
[parameter] Year has an EventCallback named YearChanged by convention.
First thing to do is create both the [Parameters] in the component. The EventCallback MUST be called VariableNameChanged, this is the convention. So in my case ProductChanged. In your case SelectedValuesChanged.
You already have the code to Invoke, although you will have to update the name.
In the Parent form, create your variable to hold the value. The "set" code is called whenever the variable is changed, as per normal. This is also what gets called when you Invoke from your component.
To tie it all together, @bind-Product="product" in your component declaration in the parent page. The capitaslized Product after the "bind-" is the [Parameter] in your component. The lowercase "product" is the local variable that we declared in the previous paragraph.