EASYUI+MVC implementation move from one dynamic popup to another dynamic pop-up box

Source: Internet
Author: User
Tags rowcount

University platform in the spirit of a more multi-function in a page to achieve the purpose, in the face of the addition of multi-popup box, you need to go from one pop-up box to another pop-up box, because the popup box is dynamic, that is, the data in the popup box, is in the controller according to the data from the dynamic spelling, When you are finished, pop up the popup box again.

View to load partial views:

@* Get Score dialog box *@    <form id= "Fmgetscore" >        <div id= "Dlggetscore" closed= "true" class= "Easyui-dialog" style = "width:400px; height:200px; padding:10px 20px >        </div>    </form>    @* get question *@    <form id= "Fmgetquestiontype" >        <div id= "Dlggetquestiontype" closed= "true" class= "Easyui-dialog" style= "width:450px; height:auto; padding: 10px 20px ">        </div>    </form>
A dynamic page method that loads the HTML that gets the score in the controller:

     #region get the score spelling HTML Zhudan December 27, 2014 15:23:27//<summary>//////&LT;/SU mmary>//<param name= "degree" > Difficulty level </param>//<param name= "Totalscore" > Total score </param&        Gt        <param name= "Hopescore" > Expected score </param>//<param name= "Dlggetscore" > table ID (temporarily useless) </param> <returns></returns> public string Getscore (int degree, int totalscore, int hopescore, string Dlggetscore) {double[] Dbldis = new double[4];//Define an array of difficulty distributions//Instantiate a Calculateproportion object to get fractions            Distribution Calculateproportion Calproport = new Calculateproportion ();            Dbldis = calproport.distribution (degree, hopescore, Totalscore);            tempdata["Degreescore"] = Dbldis; Strbuilder.            Append ("<form id=\" fmgetscore\ "method=\" post\ ">"); Strbuilder.            Append ("<table><tr>"); for (int rowcount = 0; RowCount &LT degree;                rowcount++)//The number of rows equals the number of difficulty levels {int Count = rowcount + 1;                String strdegree = "difficulty level" + Count; Strbuilder.                Append ("<td>"); Strbuilder.                Append (Strdegree); Strbuilder.                Append (":"); Strbuilder.                Append (Math.Round (Dbldis[rowcount], 2)); Strbuilder.                Append ("</td>"); Math.Round (0.333333, 2);//According to rounded international standards} strbuilder.            Append ("</tr></table></form>"); String strhtml = Strbuilder.            ToString ();        return strhtml; } #endregion
Dynamic page method for loading HTML in a controller:

  #region the spelling of query questions HTML Zhudan December 27, 2014 19:16:08//spelling HTML string public string Queryquestiontype (List<examquesti Ontypeentity> listData) {//<div style= "padding-left:50px;" >//<span>//<span id= "1" style= "width:100px; height:40px; padding-left:15px; Float:left; " >//<input type= "checkbox" value= "1" name= "Select Question"/> selection </span>//</s pan>//</div> Strbuilder.                                   Append ("<div style=\" padding-left:50px;\ ">"); foreach (Examquestiontypeentity enquestiontype in ListData) {Strbuilder.                Append ("<span>"); Strbuilder.                Append ("<span id=\" 1\ "style=\" width:100px; height:40px; padding-left:15px; float:left;\ ">"); Strbuilder.                Append ("<input id=\"); Strbuilder.                Append (Enquestiontype.questiontypename); STrbuilder.                Append ("\" name=\ "box\" value=\ ""); Strbuilder.                Append (Enquestiontype.questiontypeid); Strbuilder.                Append ("\" type=\ "checkbox\"/> "); Strbuilder.                Append (Enquestiontype.questiontypename); Strbuilder.            Append ("</span></span>"); } strbuilder.           Append ("</div>"); Strbuilder.            Append ("</table>"); String strhtml = Strbuilder.            ToString ();        return strhtml; } #endregion
JS as follows:

Get score:

function Submitfmaddtemplate () {    $ (' #fmAddTemplate '). Form (' Submit ', {        success:function (data) {            document.getElementById ("Dlggetscore"). InnerHTML = data;                        $ (' #dlgGetScore '). Dialog (' Open '). dialog (' Settitle ', ' get Score ');        }        })            $ (' #dlg '). Dialog (' Close ');            $ (' #fmAddTemplate '). Form (' Clear ');}
Get the question:

function Submitfmgetscore () {    $.ajax ({        type: "POST",        async:false,        URL: "/template/ Queryquestiontypepartial ",        success:function (data) {            document.getElementById (" Dlggetquestiontype "). InnerHTML = data;            $ (' #dlgGetQuestionType '). Dialog (' Open '). dialog (' Settitle ', ' Select question Types ');            $ (' #dlgGetScore '). Dialog (' Close ');            $ (' #fmGetScore '). Form (' clear ');        }    });

The display effect on the page:

After you click Get question:

Summarize:

To JS, Ajax is not familiar with the complete realization of the here, but also need the process, the process is very exercise people.

EASYUI+MVC implementation move from one dynamic popup to another dynamic pop-up box

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.