I'm using the MVCSiteMapProvider here: https://github.com/maartenba/MvcSiteMapProvider and trying to style my breadcrumb navigation so it has a look similar to http://www.psd100.com/wp-content/uploads/2013/02/breadcrumb-navigation-psd-free-download022701.jpg)
Has anyone had success with this? Maybe by generating a ul & li based on the current page your'e on. Right now I'm getting the breadcrumbs but I want to add an arrow background image to them, and unless I can get a ul & li, it's not possible to do.
Thanks in advance!
Actually, there is no need to create your own HTML helper (although that is certainly an option). All of the HTML helpers in MvcSiteMapProvider are templated. You can customize the default templates by editing them in the /Views/Shared/DisplayTemplates/ folder.
For the sitemap path HTML helper, you would want to edit the SiteMapPathHelperModel.cshtml (or SiteMapPathHelper.aspx) file.
Note that you can also utilize template naming to use more than one template on the same HTML helper.
#Html.MvcSiteMap().SiteMapPath("MyTemplateName")
This would match a template named MyTemplateName.cshtml or MyTemplateName.aspx.
Related
I'm building an app that lists out careers in a listing and also has a details template.
The pages in DNN are structured like this: Students (parent) > Organize (child)
I want to make a simple link in the details template (c# razor) to point back to the parent of this child page. So when I'm on Organize, make the link point back to "Students"
Looking through the 2sxc template editor, I see that I can get the parent page's ID using: #Dnn.Tab.ParentId but I'm not sure how to construct a link using that ID.
But how can I make a link to the parent page?
One simple thing you can always do is just href="/tabid/nnn" - so
Up
Based on your description, I am not sure that covers you 100% of the time, but seemed worth pointing out. :)
If you prefer a more "code" approach, use 2sxc's Link.To()...
Up
Reference
I am trying to display my data in form of a treeview in a MVC 4 application. But I am very new in MVC, so maybe somebody could recommend some step-by-step tutorial on how to use such a treeview with MVC 4?
Thanks.
There's no "ready to use" control like that in MVC. You should use a Jquery plugin for that.
Take a look in here:
UPDATED LINK:
http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
I end up using below with my MVC 4 project and it works a treat,
https://github.com/jzaefferer/jquery-treeview
I also encountered this problem.
As Thiago Custodio already mentioned, there is no standard control for this with .net mvc4
My solution is to use the html list tags < ul > and < li > which can also include nesting. And then apply some styling wih css. if you want I can post an example. I used jquery on the ul to hide/show the inner li
Cheerz, David
If you want to display data in tree view structure then I have written custom code which you can use directly. If you are interested then please reply me I will give you that code.
only you need to replace your content in that & its three level
Today i'm working on simple html editor in visual c#.
My goal is to open pure html file from local drive (Opendialog load into string or load into webbrowser completed) and allow to edit key fragments.
application should find specific divs and return the full content of that div to textbox or better to combobox (compare to combobox item and show it).
if i change the textbox (or pick up another item from combobox) application should present changes on webbrowser control.
Then i need to print this html as is seen on webbrowser control.
Last thing is to save modified hmtl overwrting original and adding comment with changes at bottom of the html file.
I want to know how to perform search&replace in this project? How to "adress" content of a div?
Better is string searching, indexof, string.replace etc. Or drown into DOM-thing (i don't know both at the moment).
How to present changes on html preview on webcontrol component? And finally overwrite a file?
Code's examples appreciated :)
Thanks in advance
You should use HtmlAgilityPack for that, it makes working with DOM a lot more easier, than parsing it yourself.
http://htmlagilitypack.codeplex.com/
For example, here is how to get all divs
var elements = hdoc.DocumentNode.Descendants("div") /.Where(.your conditions..))/;
Is there anyway to access a css class that is located in a css file, and add and remove styles from it.
Edit:
What i am trying to achieve for now, is that i have added a css file "customize", and i have added a css class in it:
.yafheader
{
display:none;
}
I just want to manipulate the display value, that is all.
I believe the simplest solution is to just put the CSS you want in the stylesheet with a new class name, and then at runtime apply that class name to the element(s) you want to modify.
Create two CSS rules - one to display and one not to display. Then create a property of your class for CSS and apply the CSS rule via the property.
Code behind is executed on the server side. So it may be possible to get the CSS class parsed and manipulate it, but you need a plan on how this manipulated object is supposed to be injected into your output. One thing you might do would be to write a new css file with your manipulated class. There might be more convenient ways of doing that however; I believe it might help if you give a bit more context about what you're actually trying to achieve.
you don't want to modify the css file itself because it can be accessed by many users simultaneously. if you change the underlying css file in response to an action by your first site visitor, the next site visitor to load the page will receive the new css file, with styles that reflect the actions of the other user on your site. do as others have suggested and define 2 classes, and add/remove the appropriate classes at runtime using javascript.
what problems can occur styling if div tags, are replaced by asp.panels (in c# code)
i have a sample code which uses pure html,
the css styles are mapped using the ids of the divs.
i would like to replace these divs by panels using c#, yes i will keep the ids same as that in css file.
question
should i expect any problems in styling because of hidden problems, or hidden styles, or default style of asp panels?
If you are developing on .NET framework 4.0 you can set ClientIdMode property to static, so asp.net don't change your Ids.
Otherwise div ids will be affected by the container's id.
Answer
There won't be any problems if you set ClientIdMode to static.
An asp.panel is rendered as a div. Once you convert it, what's rendered should be exactly the raw HTML you have now.
So if you keep the ids the same you shouldn't have any problems.