I have built the tree view using third party javascript plugins. I have also use the web templates for my asp.net MVC 3 application. And use Layout view linking to lot of css and javascript.In my category view I want to display the tree view. But the due to script of layout view the tree view is interrupted and not displaying properly. When I put Layout = Null, it shows properly. How can I set priority to the link of script and css link for displaying tree view properly
Take a look at ClientDependancyMvc NuGet package.
It allows to set priority to clientside resources like this:
Html.RequiresCss("Bootstrap/bootstrap.min.css", "Content", 2);
Html.RequiresCss("Bootstrap/bootstrap-responsive.min.css", "Content", 3);
Html.RequiresJs("jquery/1.7.1/jquery.min.js", "googleCDN", 1);
Html.RequiresJs("jqueryui/1.8.18/jquery-ui.min.js", "googleCDN", 2);
Where the last parameter is priority of inserting element into page. More info here.
Related
If I had a page type called "MySite.TextBox" and it had two fields: "Title" and "Content" what all would be required for me to make a view component that pulls all page types from the site searching from "/" and looking down to have it appear as a list of items in any view, including the layout view, using something like <vc: text-box-list > in a view, such as the _layout
What files would I need to create aside from the TextBoxList view component?
I know I'll need to make a generated code file for the MySite.TextBox page type. But it's where I set up and establish the rules for outputting the list that things get fuzzy.
For instance if I wanted to establish rules like:
var textBoxList = DocumentHelper.GetDocuments("MySite.TextBox").TopN(5).Path("/", PathTypeEnum.Children).OrderByAscending("Title").ToList();
Would that be a part of the view component or something else?
I would just really really love to have an example. I hate that the Dancing Goat and Medio Clinic sites do not have one.
1. Follow the below to Create a widget -
https://docs.xperience.io/developing-websites/page-builder-development/developing-widgets
2. Retrieves pages of multiple page types from the '/' section of the content tree:
var pages = pageRetriever.RetrieveMultiple(multiDocumentQuery => multiDocumentQuery
.Path("/", PathTypeEnum.Children));
Reference:
https://docs.xperience.io/custom-development/working-with-pages-in-the-api#WorkingwithpagesintheAPI-Retrievingpagesonthelivesite
3. Retrieve Common data from multiple page types
var commondata=Pageretriver.RetriveMultiple(multiDocumentQuery=> multiDocumentQuery
.Types("PageType1","PageType2)
.WithCoupledColumns())
.Select(page=> new <desiredobject name>
{
fieldName=page.GetString("fieldName")
});
Reference
https://docs.xperience.io/custom-development/working-with-pages-in-the-api/reference-documentquery-methods
I am new to helix pattern in sitecore. Please find below points
I have Main website project in Project//CDB.Helix.Sitecore.Project.website
like below solution structure
In website project i have PageLayout view that refrencing a placeholder for
Feature //CDB.Helix.Sitecore.Feature.Header's controller rendering.
When i add reference CDB.Helix.Sitecore.Feature.Header in main project
CDB.Helix.Sitecore.Project.website
Views/BasicHeader is not identified by main project.
How do i reuse the HeaderProject views in my main project,
How to reference effectively?
1) It is important to understand how the references should be in helix with the tree layers, so it should be one way with the following order :
project-> feature -> Foundation:
and as I see what you have done is right.
2) Then you should have placeholder lets call it "phBasicHeader" in your page layout, and this is a placholder key, where the header should be rendered:
#Html.Sitecore.Placeholder("phBasicHeader")
3) Now from Sitecore you should have rendering (controller or view) for your basicview.chtml :
4) Then from Sitecore, you add this view rendering to your item or template standard values, on the phBasicHeader like this:
I am just beginning to move from ASPX C# web forms to MVC Razor.
What I am trying to do is use the MVC global much as I did in master page code behind.
The objective is to define page title and then assign a specific image to the _Layout.cshtml.
In the aspx web pages master code behind I used Case (switch)statement like this:
string Title = PageTitle;
switch (Title)
{
case "Quality":
imgPix.ImageUrl = "images.picureA.gif";
break;
case "Services":
imgPix.imageUrl = "images.pictureB.gif":
break;
-- and so on for 8 various pages --
}
This works very well to load images on Page_Load in the aspx web pages.
I want to do this in the MVC global if possible, any suggestions are appreciated.
I have an ASP.NET MVC 3 site that makes use of a ClientDependency framework for dep. resolution (CSS/JS).
My base path's are defined in /Shared/_Layout.cshtml like this:
#MvcHtmlString.Create(Html.RenderCssHere(new List<IClientDependencyPath> {
new BasicPath("Base", "~/Content/themes/base"),
new BasicPath("Content", "~/Content")
}))
I want to have one page without a standard layout. I force it by calling
#{
Layout = null;
Html.RequiresCss("FileUpload/fileUpload.css", "Content", 20);
}
However, I can no longer request a dep. like shown above, since "Content" path isn't defined.
I am rather new to ClientDependency framework, so which is the best way for me to get my dependencies in a non-layout view?
I need to have the Path declared somewhere in the View, as well as the RenderCss/JsHere element, so if I don't use a shared layout, I had to re-declare it in my custom page all together.
I have a custom CMS built with ASP.NET WebForms (you can see it in action at Thought Results). Now I want to build it using ASP.NET MVC 3 (or even 4). I don't want to change the architecture that much, therefore, I need to dynamically load a Razor View, and dynamically run a Model Loader method, and give the model to the view dynamically, then render the view, and return the result rendered string, all done in server.
In ASP.NET WebForms, my code is:
string renderedString = "LatestArticles.ascx".LoadControl().GetReneredString();
Now, I'd like to be able to write a code line like:
string renderedString =
"LatestArticles.cshtml".LoadView().BindModel("ModelBinderMethodName").Render();
I know about many questions about rendering a view (view to string), but I didn't find what I want.
You may checkout RazorEngine.