I believe that many. NET developers are still using the Asp.net framework, or some of them are working on ASP.net and Asp.net MVC projects. For the traditional Asp.net to have a good experience, the Ajax effect is of course indispensable...
I asked a colleague just now. I said that I want to upload data in JSON format in the background on the front-end page of Asp.net. Which method do you think is better? The answer must be ihttphandler.
I totally agree... What do you choose as a conversion tool for JSON objects? Newtonjson... Good idea .. I also like this serialization deserialization library.
Http://json.codeplex.com/This thing may have been used many times...
Even with nuget, you don't need to bother Downloading this class library...
Most of the problems have been solved. Select a jquery tree control. The first thing I think of is jstree. I believe you will love it if you have used it. Unfortunately, it is not compatible with ie9 .................................
Some people may have used this tree control, http://code.google.com/p/jquerytree/ name is ztree, Chinese write, although the write almost, but the compatibility is good... It is worthy of praise...
Because it involves asynchronous data transmission, I tried to find its Ajax method call. In fact, this write is not reasonable. The author mainly writes it for PHP and JSP, therefore, the method of receiving data is for ASP. neter is not applicable... The Ajax Method for modifying it is as follows:
In this case, an example is provided... But try to think, should I have a better and simpler way?
I already had another implementation method. I told my colleague that I had a way to see who would implement the function first. O (distinct _ distinct) O ~
1. Create a solution for Asp.net 3.5. Add default. aspx, jquery. ztree-2.6.js, and style files.
2. Add two references:
Yes, I will use webmethod to post data to the foreground, and use the. NET class to serialize the dataset into a JSON object. At this time, he is still downloading Newton. JSON to add
Xxx. ashx.
3. Create a web method:
4. Ajax for jquery to get data...
Because ztree has encapsulated the Ajax method, we only need to pass the URL to it and it will be OK.
Run and try to get the data:
If a node is a parent node, the current ID and name will be passed to the server during the Ajax request, and the corresponding subset will be queried in the background, then return in JSON format ..
Display result:
I hope you will have a chance. If it's useless, it's just fun... By the way, that colleague is still debugging... O (distinct _ distinct) O ~