Drag and drop tree view asp.net c# without third party control - c#

I'm looking for ASP.NET TreeView drag and drop functionality without using a third party control. Can anyone guide me with JavaScript code?

This is not possible out of the box. Of course you could write your own drag & drop functionality, but the effort will be huge and you need to have very good JS and/or jQuery skills to do this.
I would prefer to using a third party JS/jQuery TreeView Control with Drag and Drop capabilities. So you will have less headache with using existing one also less error rate.

Related

Best resource to learn How to Create AJAX enabled User Controls

In our project, we use lot of User Controls. None of them supports AJAX. We use UpdatePanel for partial page rendering. There is no proper client side functions for the controls.
I used to create normal JS functions in the ascx page itself. I guess it is not the standard way to add client functionality to a User Control. However i can achieve all the things which i required , with out using any such standards. But when considering the maintainability, it is tough & it is hard to make changes & not scalable.
So i want to learn the proper way to create AJAX enabled User Controls. Just like how Telerik & other 3rd party controls create User Controls. What is the recommended way to create such controls by Microsoft.
Could you be more specific about the problem with Update Panel??
To use inbuilt ajax,
1. You need a ScriptManager
2. Put all necessary controls within Update Panel
Since you are using User Controls, its better to add ScriptManager in the main page where the User Control is added. Otherwise it might give an error saying multiple ScriptManager found.
UpdatePanel uses AJAX and is easy to use, however, if you want true client side controls, i.e. only call the server when you need too, then it's probably best to look elsewhere.
If you want to write your own controls, I'd recommended reading about some JavaScript design patterns, specifically the module pattern. If you have decent JavaScript skills, it's extremely easy to create controls with the help of jQuery - may as well make it a jQuery plugin. You might want to check out some client side MVC/MVVM frameworks like AngularJS or Knockout might be enough, because at least they'll help you with data bindings so it's less painful to manage the data on the client side and get it back to the server.
But, unless you're doing some that no one else has done before, why not use some existing controls by Telerik or DevExpress for example?
Example of module pattern (there's a bunch of different ways to do module pattern, this is just one):
var myModule = {
/* PROPERTIES */
prop1: 'sdfsdf',
prop2: 123,
/* FUNCTIONS */
func1: function () {
alert('!!!');
}
}
/* example use of module */
alert(myModule.prop1);
myModule.func1();
You'll also need to have a good understanding of events in JavaScript. For example, if you wanted to create a client side grid (there's millions already available for free), you'd need to handle click and text changed types of events. i.e. to handle paging, sorting, filtering and any other feature you might want out of your grid.
Edit: just created a basic JSFiddle to give you an example of a really basic client side control using a jQuery plugin. It doesn't work perfectly, but thought it might give you an idea of where to start if you wanted to try making your own controls.
http://jsfiddle.net/pwqmenwx/1/

Drag and Drop in ASP .Net?

What is the simplest way to integrate drag and drop functionality?
I will have, for example a list of cases, and a list of employees and I will need to assign a case to one or more employees (among other things).
It looks complicated to do this type of task.
Is there a library or something that simplifies this?
How is it normally implemented?
Yes, use JQuery and JQuery UI, which has a draggable plugin and droppable plugin to configure this. There is nothing inherently built-in to ASP.NET.
To enable dragging, it's as simple as $( "#draggable" ).draggable();, where the #draggable is the ID of the element to drag. You can also customize the options for when dragging can be enabled, etc.

Multi-line ListView without third party component

is there a way to enhance .NET ListView control to capable to show two line items? I couldn't use third party libraries.
Thanx
There is no method to enhance the buil-in in list view control.
have you thought about creating a 'user control'? that for sure will allow you to dream up your own list view that would allow for multi line.
Regards

Windows Forms control that behaves like the ASP.NET Ajax AutoComplete extender?

Successfully using the AJAX Control Toolkit AutoComplete extender, I'm looking for a Windows Forms 2.0 control that behaves similar to it:
Since I want to use the control to enter multiple e-mail receivers, my primary requirement is to have multiple, independent items to auto-complete.
I.e. this cannot be done by the standard auto complete feature of a TextBox control which only supports auto-completing one string.
In other words, I'm looking for something similar than Outlook's e-mail text box (but not as advanced, just the auto-complete part, no underlining required):
Even after searching Google (and Bing) for quite a long time I manage to have no luck in finding such a control.
My question:
Is there some example out there on how to build such a control, or even a finished control to use?
Since the application should be very slim, I do not want to use 3rd party libraries like DevExpress or Telerik or Infragistics.
Update 2014-12-24:
The commercial DevExpress library now has a Token Edit Control that might just be the control I was looking for:
You might take a look at the IAutoComplete interface. That will let you create a class that you can use instead of the standard auto-complete for an edit box. In that class you would handle what part of the string you are auto-completing on and the source of where the data is coming from.
http://msdn.microsoft.com/en-us/library/bb776292(v=VS.85).aspx

treeview in asp.net

I want to use a treeview control in my asp.net project and when i drag and drop anything, it should update database. and there should be sort, when I change the sort when I drag and drop, the order column should be changed at the database.
(It is clear that treeview will get the items from database.)
I would search for examples of this via google to see what options are available with the standard .NET components, and 3rd party components (commercially purchased and jquery style plugins) See which one best fits your need and have a go at implemneting what you need. If you have further problems, let us know.

Categories