Vs2013+mvc3.0+easyui's ComboBox linkage use (ii)
Introduction: use MVC3.0 in vs2013 (. net4.0) for the linkage of the ComboBox in Easyui,
Loading the ComboBox data, and realizing the linkage effect,
This article uses the date control in Easyui to achieve a linkage effect with the ComboBox,
--------------------------------------------------------------------------------------------------------------- --------------------------------------
The following shows the code of 3 practical modules:
Controller (Control):
<summary>/////////</summary>///<param Name= "Strdate" > Date based on user selected date </param> <returns></returns>//<remarks> creator (DATE): ★ Pengzhen ★ (141016 11:24) </remarks> public jsonre Sult getsendbillcodebydate (String strdate) {Isale_outerlistservice ser = sale_outerlistservice.instance; String json = string. Empty; try {//Get available courier company Information for DataSet ds = Ser. Getsendbillcodebydate (Strdate, userhelper.userinfo.storageids[0]); System.Data.DataTable dt = ds. Tables[0]; if (ds! = null && ds. Tables.count > 0) {dt = ds. Tables[0]; } else {return JSON (JSON); } if (dt! = null && dt. Rows.Count > 0) {list<dynamic> List = new list<dynamic> (); foreach (System.Data.DataRow dr in Dt. Rows) {list. Add (New {ID = dr["Sendbill_code"]. GetstrING (), Name = dr["Sendbill_code"]. GetString ()}); //2 isolated data to json JSON = list. Tojsonserialize (); } else {return JSON (JSON); }} catch (Exception ex) {json = string. Empty; }//3 Output return JSON (JSON); }
--------------------------------------------------------------------------------------------------------------- --------------------------------------
Pub (page):
<TD style= "width:50px;" class= "Tbl-label" > Date </td> <td style= "width:150px;" class= "Tbl-value" > <input id= "dtsendbilldate" type= "text" class= "Inp-normal"/> </td> <td class= " Tbl-label "> Shipping number </td> <td class=" Tbl-value "> <input type=" text "id=" Sendbill_code "Name=" Sendbill_code "class=" Inp-normal "/> </td>
--------------------------------------------------------------------------------------------------------------- --------------------------------------
Biz (JS):
<script language= "JavaScript" > $ (function () {//Generate Easyui Datetimebox $ (' #dtSendBillDate '). Datebox ({req Uired:true, onselect:function (date) {var year = Date.getfullyear (). toString (); var month = (Date.getmonth () + 1). toString (). length = = 1? "0" + (date.getmonth () + 1). ToString (): (Date.getmonth () + 1). ToString (); var day = (Date.getdate (). toString ()). length = = 1? "0" + date.getdate (). ToString (): Date.getdate (). ToString (); var selectdate = year + month + day; Loduphelper.getsendbillcodelist (selectdate); } }); Lodup Help class var loduphelper = {getsendbillcodelisturl: "/pack/getsendbillcodebydate",//Get issue number group Getsendbillcode List:function (selectdate) {Loduphelper.ajaxasync (Loduphelper.getsendbillcodelisturl, {strdate:selectdate}, func tion (data) {Datasetcode = eval ("(" + Data + ")"); Comboboxcode = {valuefield: ' ID ', TextField: ' Name ', Data:datasetcode, Required:true, Editable:false}; $ (' #SendBill_Code '). ComboBox (Comboboxcode); }); } }; });</script>
Vs2013+mvc3.0+easyui's ComboBox linkage use (ii)