Hello friends!, I am doing a sort by a select field. When you choose one of the options, since this value is Obtained. Then this value, I would pass it on to OrderBy(), dynamically. Look at my code:
var vars = "date-desc"; var order = vars.Split("-"); var nodes = Model.NodeById(@Model.Id).Descendants("Clothes").Where("Visible").OrderBy("createDate "+ order[1]);
If you have any better idea to to do this, please let me know. Thank you!
var vars ="date-desc"; var order = vars.Split("-"); var searchBy = "createDate" + order[1]; var nodes =Model.NodeById(@Model.Id).Descendants("Clothes").Where("Visible").OrderBy(searchBy);
How to pass variables to OrderBy in Razor?
Hello friends!, I am doing a sort by a select field. When you choose one of the options, since this value is Obtained. Then this value, I would pass it on to OrderBy(), dynamically. Look at my code:
If you have any better idea to to do this, please let me know. Thank you!
I found the solution:
is working on a reply...