Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Im looking to set the default value on a radio button list.
Any help would be grateful.
var preValue = Umbraco.GetPreValueAsString(Model.GetPropertyValue<int>("radioButton"));
I'm a little bit confused here - Are you in fact trying to render a list of radio buttons where you want to have one of them being set marked by default?
Or is is that you want to render the selected radio button from the Umbraco backoffice in a <h1> element? If so...I can imagine you receive an error currently since the the opening tag is not formatted correctly. For what I can see the preValue variable looks like it's been setup correctly.
So can you try fixing the <h1 @prevalue</h1> to be <h1>@preValue</h1> - Sorry if I misunderstand but then please let me know :)
Im being stupid.
I was wanting to setup a radio button list that has three options and have a default selected in the backend.
No worries mate :-)
Hmm, I'm not sure that it's currently possible. I recall I've seen other posts asking about how to do this since I remember thinking about having a look at maybe extending the property editor to allow for such scenario. But I have not come around to it yet though :) - Not sure when/if I will. It's on my list of ideas though.
I can't remember if perhaps something like it can be achieved using NuPickers though?
I too would like to be able to set the value of a radiobutton list from a surface controller. Mine would be in members.
Looks like I just need to get the Id of the radio button. We know the string value so a function to return the Id (value) from a string (text) would be great.
I have managed to set a value using IMember class supplied by MemberService.
Create your radiobutton list and select the value you want to default to.
Print the value to screen or debug to get it.
int approvalValue = IPublishedContent.GetPropertyValue<int>("radioButtonList");
I was able to use to below to set the int value of the radiobutton I wanted to Set:
As a workaround, you should be able to check the value in the ContentService.Published event and if value is not set (int value 1 for me), set the default value you want.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted