TreeView for mvc4 - c#

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

Related

How can I build a link to navigate to the parent page inside of a 2sxc app using c# razor templates?

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

How to dynamically render HTML in ASPX without embedding HTML in C# code or C# code in ASPX code?

I'm trying to loop through a data set on the server-side (not a problem) and dynamically render HTML based on the items in the dataset (super basic stuff). Here's the simplified HTML:
<div>item title</div>
<div>item date</div>
<div>item summary</div>
I have 10 items being returned on the back-end, so I'd like to write out 10 iterations of the HTML above. I know this is super basic stuff, but I'd like to do this in ASP.NET without 1) embedding HTML in the C# code 2) embedding C# in the ASPX code
Is this possible? What's the best way to do this? I'm also not using MVC, so please keep that in mind. Thank you.
I would consider using a Repeater for this
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater(v=vs.110).aspx
It's a control designed for repeating arbitrary html based on the content of a data source

Styled breadcrumb navigation using MVCSiteMapPath

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.

How to put a LinkButton INTO a tooltip using ASP.NET?

When using the core ASP.NET 3.5 (w/ Ajax), is it possible to include a LinkButton in a tooltip?
Unfortunately, these tooltips are generated on-the-fly within a GridView to display custom data from each row. Tooltips are currently showing using jQuery.
So, I don't know how to add a LinkButton (for a "Modify" action) to call a method on code-behind.
Maybe I'm going the wrong way... Any suggestions?
Thank you!
UPDATE : Seems like a Server side control Implementation : http://devarchive.net/advanced-tooltip-control-asp-net-ajax.aspx
There is no direct way to do this. You can find some plugins in JQuery which helps to do this. Try the one #Andre Hühn provided. This one also looks good : http://jquery.bassistance.de/tooltip/demo/

Dragging & dropping items from one list to another in a ASP.NET page?

I would like to move items from one list to another on a page, and I'm pretty flexible about what type of a list it is. What's the best way to do that? ASP.NET Ajax? jQuery? Anything else?
There's a nice tutorial on CodeProject that covers dragging with ASP.NET and jQuery:
http://www.codeproject.com/KB/webforms/JQueryPersistantDragDrop.aspx
if you want to do this and PostBack instead of using AJAX to update your data based on from fields you'll need to get creative about what types of controls you use. Page validation will complain about ASP controls like dropdownlists, listboxes, etc. if they contain selected items that weren't in the list when it was rendered.
Better to use AJAX to send back your updates or use HTML controls like unordered lists or select added via javascript and stuff the selected data in another control that doesn't complain (hiddenfield) on PostBack. The alternative is turning off page validation and I don't think that's a good idea.
You can also might look at YUI Library, I'd say it implements Drag & Drop in a very simple and flexible way:
http://yuilibrary.com/yui/docs/dd/
There are a lot of examples etc...

Categories

Resources