如何将自定义radzendropdown项目设置为页面加载?
我已经在下面显示的代码中填充了Radzendropdown,
<RadzenDropDown @bind-Value="SomethingValueSelected" TValue="int" AllowFiltering="false" AllowClear="false" SelectedItem="0" SelectedItemsText="Test-1"
Data=@SomethingList TextProperty="Name" ValueProperty="Value"/>
这是带有填充项目的列表:
List<SomethingDTO> SomethingList= new List<SomethingDTO>(){ new SomethingDTO{ Name = "Test-1", Value = -1 },
new SomethingDTO{ Name = "Test0", Value = 0 },
new SomethingDTO{ Name = "Test1", Value = 1 },
new SomethingDTO{ Name = "Test2", Value = 2 },
new SomethingDTO{ Name = "Test5", Value = 5 }};
int SomethingValueSelected;
I have populated a RadzenDropDown in the code shown below,
<RadzenDropDown @bind-Value="SomethingValueSelected" TValue="int" AllowFiltering="false" AllowClear="false" SelectedItem="0" SelectedItemsText="Test-1"
Data=@SomethingList TextProperty="Name" ValueProperty="Value"/>
Here is the list with populated items:
List<SomethingDTO> SomethingList= new List<SomethingDTO>(){ new SomethingDTO{ Name = "Test-1", Value = -1 },
new SomethingDTO{ Name = "Test0", Value = 0 },
new SomethingDTO{ Name = "Test1", Value = 1 },
new SomethingDTO{ Name = "Test2", Value = 2 },
new SomethingDTO{ Name = "Test5", Value = 5 }};
int SomethingValueSelected;
And here is what i get when page loads:
My question is, how do I get automatically selected item called "Test-1", with the value of -1?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,这似乎很简单 -
只需将被束缚的元素的值设置为您喜欢的价值,就我而言是
Well it seems like quite a simple one -
just set the value of element that is being binded to a value that you prefer, in my case it was