Binding to Razden components

Radzen.Blazor 0.0.44 was just published!

1 Like

That works great thanks.
@bind-SelectedItem="@slectedItem" now gives you the object.

How do you get the latest Radzen.Blazor? Is it included in Radzen 2.19.6?

Hi Alan,

You can get it from NuGet:
https://www.nuget.org/packages/Radzen.Blazor/

I have the latest version of RadZen downloaded (2.19.8) and I can see a template field property for RadzenDropDown (Blazor) but not sure what format is required (not the same as angular template format). I've looked at the code generated and am using the following in the template field. @((data as ).). I see their is also a designer but I can't seem to get that working, it displays a popup window but I can't see what I should be doing there.

You can drag & drop components from Radzen toolbox in the template designer:


1 Like

I'll give that a go tomorrow, if I don't use the visual designer then is my other method the correct way of filling the template field? ie. @((data as ).) eg. @((data as User).Surname), @((data as User).Firstname) would produce Surname, Firstname

Here is an example how to write template manually:

@(((dynamic)data).FirstName + " " + ((dynamic)data).LastName)


2 Likes

Hi,

This did not work for me
Do you have sample code ?

Thank you
Fatima

<RadzenDropDown Placeholder="Select Account..."
                        Data="@SqlAccountList"
                        TextProperty="AccountName"
                        ValueProperty="Id"
                        Change="@(args => OnDropdownChange(args, "1"))"
                        Style="width: 250px; margin-bottom: 20px"
                        @bind-SelectedItem="@_selectedItem">
            <Template Context="sqlUserContext">
                @((sqlUserContext as SqlUser).AccountName)
            </Template>
</RadzenDropDown>

and in my code section

private object _selectedItem;

and when I want to access the various properties

SelectedSqlAccount = (SqlUser)_selectedItem; << This would give you the selected object (SqlUser)

SqlAccountList defined as....
IEnumerable<SqlUser> SqlAccountList is the object I'm binding too

Thank you Mark, I was trying to preselect the options in the dropdown from another table.
But that's when I get object reference error.

Also this is for Multiple = true

Hi,
I have the same problem. Did you find a solution for this.

Thanks,
Fatima

can i use @bind-SelectedItem Property with DropDownGrid?

Please check the issue that i reported here.

is there a way to assign pre-selected values to a dropdown grid apart from bind-value as bind-value requires a two way values. I just need to assign it the list of selected values from local storage instead of a variable. if is use bind-value , it makes my page very very slow.

@enchev , request you to please suggest.

Hey @sqadir,

There is such example in our demos. Do not demand support or we discontinue your account.

Sorry i dint mean to demand, i think i just missed a link - Radzen dropdown performance issue - #6 by sqadir

Rephrasing :

Please check the issue that i reported here: Radzen dropdown performance issue - #6 by sqadir

is there a way to assign pre-selected values to a dropdown grid apart from bind-value as bind-value requires a two way values. I just need to assign it the list of selected values from local storage instead of a variable. if is use bind-value , it makes my page very very slow.

Apologies if i was not able to explain my issue in the right way but there is no demand, please be assured.

Also would be of great help if you can please navigate me to an demo example where we are assigning / pre-selecting multiple selected values to drop down without using bind-value. That will actually solve my problem.

I just had the same problem. My problem was that the onchange didn't trigger when using List<> properties. I've changed them to IEnumerable, and that fixed the problem for me