Hi, I hope everybody is fine.
I have a SQL Server database with a field [Abrechnungsart] of type smallint nullable, which is correctly transformed to short?
This field contains the values NULL, 0 and 1.
I would like to present those three values with a radio button list in the UI but I cannot find out how to do that.
I have already tried many different things and I have read the documentation and searched the forum but could not find anything.
Can you please tell me how to achieve this?
Best regards and thank you
Frank
johnmu
March 14, 2021, 8:04pm
2
Frank
Bind the radio list to your source and set the value of the items to the range of values your source can create.
John
Hi John,
Thank you for your response. There is no source. That is the problem. That is why I wrote this.
Best regards
Frank
Adding the items requires more work because of their type short?
. Blazor infers numbers as int
by default so we have to take a few extra steps.
Create page properties for all values - null, zero and one. Make sure their Type is set to short?
as the inferred type would be dynamic
for null and int
for zero and one.
Create another property of type short?
which will store the Value of the RadioButtonList.
Set the Value property of the RadioButtonList and Add the Items. Use the properties from step 1 for the Value of every item.
Cool idea! Thank you, Atanas!