Radiobutton with custom content - e.g. DropDown

0 Answers 15 Views
RadioButton RadioGroup
Daniel
Top achievements
Rank 3
Iron
Iron
Iron
Daniel asked on 10 Dec 2021, 02:37 PM | edited on 10 Dec 2021, 03:23 PM

Hey guys,

currently I have an use-case where I could need a radio group with some standard text options but one radio with a dropdownlist.
With googling I could find only one question similar to this with a solution in kendoReact.

Is there a best practice solution to realize this in .NET Core?

https://www.telerik.com/forums/dropdownlist-with-radio-button-not-working
And a working example here: https://stackblitz.com/edit/react-1gnbzt?file=app/main.jsx

Does it make sense to combine radio buttons for common options with a drop  down menu for less common options? - User Experience Stack Exchange

Cheers!

 

EDIT:

Sure, like always. After asking the question, I could solve it by myself. Thanks anyways! 

@(Html.Kendo().RadioGroup()
                    .Name("xxx")
                    .Items(i =>
                    {
                        i.Add().Label("United States").Value("1");
                        i.Add().Label("Canade").Value("2");
                        i.Add().Label("Mexiko").Value("3");
                        i.Add().Value("4").Encoded(false).Label("Other: " + Html.Kendo().DropDownListFor(x => x.ProviderId)
                                    .DataSource(source => source
                                        .Custom()
                                        .Sort(x => x.Add(Html.NameFor(y => new Provider().Name)))
                                        .Transport(x => x
                                            .Read(read =>
                                            {
                                                read.Url($"https://{webApiHost}/fruehehilfen/api/Provider").Headers(new { authorization = user.TokenString });
                                            })))
                                    .DataTextField(Html.NameFor(x => new Provider().Name))
                                    .DataValueField(Html.NameFor(x => new Provider().ID))
                                    .HtmlAttributes(new { style = "width: 100%" })
                                    .OptionLabel("Bitte auswählen").ToHtmlString());
                    })
                )

No answers yet. Maybe you can help?

Tags
RadioButton RadioGroup
Asked by
Daniel
Top achievements
Rank 3
Iron
Iron
Iron
Share this question
or