now my code is like .... it shows error as Error loading MacroEngine script (file: CompetitionDropDown.cshtml) when page is run. no error on saving razor file.
yes... I wanted this.. but now I need to compare in where condition by ignoring case in below statement... means toLower() to be used for Name property value and first.Name value.
... in above code you can see that I am looking for Query string parameter named 'comp' and then setting value of 'select' input to querystring parameter value. But problem is that while passing parameter I convert it to lower case but dropdown contains value with uper case and lower case letters. So, I need to set value by comparing to_lower(parameter value ) and to_lower (select input value) ... how can I do that in script above?
filter nodes
I want to filter child nodes by node name... say I have string variable to which I will compare node name...
so how can I do that in razor?
Hi. Try something like:
ok thanks I used as u said...
now my code is like .... it shows error as Error loading MacroEngine script (file: CompetitionDropDown.cshtml) when page is run. no error on saving razor file.
@using umbraco.BusinessLogic;
@using umbraco.MacroEngines;
@inherits umbraco.MacroEngines.DynamicNode
@inherits umbraco.MacroEngines.DynamicNodeContext
@{
string compval="";
<select id="ddlcompetition">
@{
int i=1;
foreach (var item in @Model.Children.OrderBy("CreateDate desc"))
{ if(i==1)
{
@: <option value="@item.Name" selected="selected">@item.Name</option>
compval=@item.Name;
}
else
{
@: <option value="@item.Name">@item.Name</option>
}
i++;
}
}
</select>
var node = Model.Children.Where("Name = @0", compval);
if(@node.Count == 1)
{
dynamic link = Library.MediaById(@node.competitionThumbImage);
dynamic link2 = Library.MediaById(@node.competitionImage);
}
}
Hi. Is this what you want?
yes... I wanted this.. but now I need to compare in where condition by ignoring case in below statement... means toLower() to be used for Name property value and first.Name value.
Be aware that .where has some performance problems: http://our.umbraco.org/forum/developers/razor/28479-Razor-menu-performance-(v4)
Jeroen
Changing
to
should work, I suppose.
(Not sure absolutely - there're limitations on using methods in dynamic LINQ, but as far as I remember for strings it's possible).
thank you ... it works... but now I need one more help... my razor code is as follows...
... in above code you can see that I am looking for Query string parameter named 'comp' and then setting value of 'select' input to querystring parameter value. But problem is that while passing parameter I convert it to lower case but dropdown contains value with uper case and lower case letters. So, I need to set value by comparing to_lower(parameter value ) and to_lower (select input value) ... how can I do that in script above?
is working on a reply...