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
I have searched for this to no avail.
I would like to select properties bases on the value of a radio button.
So I have a radio button list for Bedrooms.
I want to query all properties that have more than a selected amount of bedrooms.
The number is stored as a radio button value between one and seven.
berthV is a number between one and seven selected on a previous page.
selectionNodes = CurrentPage.Children() .Where("documentTypeAlias == \"vehicleDetailPage\"") .Where("selectorBerth >= @0", berthV) .Where("Visible").OrderBy("createDate desc");
I thought it would be as simple as that but selectorBerth is the ID of the button not it's actual value.
Is this possible at this stage in the query
Rob
Hi Rob
What did you mean here?
All properties of current document? All documents?
In the code example you are trying to get child nodes:
I would rewrite your code like that:
int berthV = 3; var selectionNodes = Umbraco.AssignedContentItem.Children() .Where(x => x.DocumentTypeAlias.Equals("vehicleDetailPage")) .Where(x => x.HasValue("selectorBerth") && int.Parse(Umbraco.GetPreValueAsString(x.GetPropertyValue<int>("selectorBerth"))) >= berthV) .Where(x => x.IsVisible()).OrderByDescending(x => x.CreateDate);
The most interesting code is:
int.Parse(Umbraco.GetPreValueAsString(x.GetPropertyValue<int>("selectorBerth"))) >= berthV
x.GetPropertyValue - returns id of value in radio button
Umbraco.GetPreValueAsString - returns value of prevalue in string
Hope it makes sense for you.
Thanks,
Alex
Hi Rob, did you solve the issue?
Hey Alex, I'll be working on it today I'll update later :)
Thanks very handy. I get it now as my original code was returning the node number id not the content
Cheers Rob
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Query the Value of a Radio Button not it's ID
I have searched for this to no avail.
I would like to select properties bases on the value of a radio button.
So I have a radio button list for Bedrooms.
I want to query all properties that have more than a selected amount of bedrooms.
The number is stored as a radio button value between one and seven.
berthV is a number between one and seven selected on a previous page.
selectionNodes = CurrentPage.Children() .Where("documentTypeAlias == \"vehicleDetailPage\"") .Where("selectorBerth >= @0", berthV) .Where("Visible").OrderBy("createDate desc");
I thought it would be as simple as that but selectorBerth is the ID of the button not it's actual value.
Is this possible at this stage in the query
Rob
Hi Rob
What did you mean here?
I want to query all properties that have more than a selected amount of bedrooms.
All properties of current document? All documents?
In the code example you are trying to get child nodes:
I would rewrite your code like that:
The most interesting code is:
x.GetPropertyValue - returns id of value in radio button
Umbraco.GetPreValueAsString - returns value of prevalue in string
Hope it makes sense for you.
Thanks,
Alex
Hi Rob, did you solve the issue?
Hey Alex, I'll be working on it today I'll update later :)
Rob
Thanks very handy. I get it now as my original code was returning the node number id not the content
Cheers Rob
is working on a reply...