Query string from droplist multiple Datatype in Razor
How would you get a query string from a droplist multiple Datatype?
We are trying to pull all pages with a certain DocType. We are able to pull them by the creatorName. We have "categories" set up in a Dropdown List Multiple Datatype. We are trying to pull the onces with certain categories selected. As you can see in the code we have a Helper Method we are passing a value to call PostListings. As you can see we have the Author in there and that query string is already working. We need to know how to do this for the Dropdown List Multiple in which we have our Categories predetermined. And the authors can choose multiple categories. We need to try to pull those Nodes that belong to those categories.
Below we have a list of the categories we are getting from the Dropdown List Multiple Datatype, then the If/Else passing the PostListing to the Helper Method. How would we pull only the Nodes with those specific "Categories". Does that make sense?
Thanks in advance.
Our code is below.
This is our list of Categories with links. This is actually a separate file from the main list of Nodes we are trying to get.
Query string from droplist multiple Datatype in Razor
How would you get a query string from a droplist multiple Datatype?
We are trying to pull all pages with a certain DocType. We are able to pull them by the creatorName. We have "categories" set up in a Dropdown List Multiple Datatype. We are trying to pull the onces with certain categories selected. As you can see in the code we have a Helper Method we are passing a value to call PostListings. As you can see we have the Author in there and that query string is already working. We need to know how to do this for the Dropdown List Multiple in which we have our Categories predetermined. And the authors can choose multiple categories. We need to try to pull those Nodes that belong to those categories.
Below we have a list of the categories we are getting from the Dropdown List Multiple Datatype, then the If/Else passing the PostListing to the Helper Method. How would we pull only the Nodes with those specific "Categories". Does that make sense?
Thanks in advance.
Our code is below.
This is our list of Categories with links. This is actually a separate file from the main list of Nodes we are trying to get.
This is in our other page that has our IF/ELSE and our HelperMethod
@*Helper Method*@
@helper PostListings(DynamicNodeList list)
{
var baseNode = @Model.AncestorOrSelf("DWTBlogLanding");
<ul class="dwtPostList">
@foreach(DynamicNode nodeItem in @list){
<li>
<h3>
<a href="http://website.test.dmns.org/@(baseNode.Url)Post/?nid=@(nodeItem.Id)">@nodeItem.Name</a>
</h3>
<div class="dwtPosted">Posted @nodeItem.CreateDate by @nodeItem.CreatorName</div>
@Html.Raw(@nodeItem.GetProperty("landingPageContent").Value)
@*@Html.Raw(@nodeItem.GetProperty("bodyText").Value)*@
<div class="dwtBtnHolder">
<a href="http://website.test.dmns.org/@(baseNode.Url)Post/?nid=@(nodeItem.Id)" class="buyNowBtn">Read More</a>
</div>
@if(@nodeItem.HasValue("dwtBlogCategories")){
<div class="dwtBlogCatTagContainer">
<div class="dwtPostListCategories">
<span> Categories: </span>
<ul class="dwtPostListCategoriesList">
@{var categories = @nodeItem.GetProperty("dwtBlogCategories").Value.Split(",".ToCharArray());}
@foreach(var c in categories){
<li><a href="@baseNode.Url?category=@c">@c</a></li>
}
</div>
</div>
}
</li>
}
</ul>
}
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.