This article illustrates the implementation method of returning JSON data with ASP.net coordination Easyui implementation. Share to everyone for your reference. Specifically as follows:
Recently, I want to use asp.net with Easyui to develop a small framework, and then use to Easyui combobox when there is a problem, it is known that the Easyui document on the ComboBox format is
Copy Code code as follows:
<input class= "Easyui-combobox"
Name= "Language"
Data-options= "
URL: '.. /combobox/combobox_data1.json ',
Valuefield: ' id ',
TextField: ' Text ',
Multiple:true,
Panelheight: ' Auto '
">
In the beginning, I wanted to write with Ajax using the ASP.net micro-blogging [method] approach, but there was a problem with the AJAX approach using [method], which is the following format,
Copy Code code as follows:
$.ajax ({
Type: "Post",
URL: "Addbug.aspx/getversions",
Data: "{' Producename ': '" + SelectedValue + "'}",
DataType: "JSON",
ContentType: "Application/json; Charset=utf-8 ",
Success:function (data) {
$ ("#versions"). empty ();
$ ("#versions"). Append (DATA.D);
}
});
That is, must write out its contenttype, but this for Easyui ComboBox data-options parameters are not, so that the return result contains a lot of HTML statements, tangled for a long time, Then accidentally tried the. ashx file and found it was successful.
Then I looked it up again. The role of the ashx file, in simple terms, is to provide the ability to return strings and pictures without returning processing results and a lot of HTML as in the case of an. aspx file.
I hope this article will help you with the ASP.net program design.