Little tease in 2014 contact mvc, at that time for me, that is just graduated, that is a word, "difficult on the sky", haha, open a joke, the following start the Subject.
Rich Text Editor
When using a rich text editor in an MVC form, The program will report security issues, and the workaround is to add [validateinput (false)] above the Controller's receive method
Similar to the ASPX page in enableeventvalidation, the following
. jquery Easyui Dialog Service This editor does not get focus
By default, when you use dialog in a page to present a rich text editor in the current page div, you can display, but not edit, the Focus.
When you click the Full-screen display, zoom out, you get Focus.
The key to solving this problem: in the properties of diaog, initialize the editor with the OnOpen method,
Below the code, compare Straight.
var keditor;
$ ("#divAddHospital"). CSS ("display", "block");
$ ("#divAddHospital"). Dialog ({
Title: "add hospital",
modal:true,
width:720,
height:400,
collapsible:false,
minimizable:false,
maximizable:false,
resizable:true,
Onopen:function (event, Ui) {
Keditor = kindeditor.create (' #editor_id ', {
Themetype: ' Simple ',
Csspath: [' ... /.. /scripts/kindeditor-4.1.10/plugins/code/prettify.css '],
Uploadjson: [' ... /.. /scripts/kindeditor-4.1.10/asp.net/upload_json.ashx '],
Filemanagerjson: [' ... /.. /scripts/kindeditor-4.1.10/asp.net/file_manager_json.ashx '],
allowfilemanager:true,
Allowcreate:function () {
var = this;
Kindeditor.ctrl (document, function () {
Self.sync ();
Kindeditor (' form[name=editor_id] ') [0].submit ();
});
Kindeditor.ctrl (self.edit.doc, +, function () {
Self.sync ();
Kindeditor (' form[name=editor_id] ') [0].submit ();
});
}
});
},
Buttons: [{
Text: ' Add ',
Iconcls: ' Icon-ok ',
left:50,
Handler:function () {
Savehospitalinfo ();
}
},
{
Text: ' Cancel ',
Iconcls: ' Icon-ok ',
left:50,
Handler:function () {
Addcancel ();
}
}]
});
Ajax.beginform form submission in 3.MVC
① when a checkbox is included in a form, the form cannot be submitted if the checkbox is not selected
Workaround: when the background C # code receives the checkbox value, the above problem is resolved by using a string type instead of a bool Type.
②ajax.beginform If you want to judge before committing, just add the attribute when BeginForm
③jquery Easyui form submission of several ways to add judgment
Ajax.beginform Submitting a form
Ajax.beginform (method, controller, New ajaxoptions () {onbegin= validation Method name, Onsuccess= method name after submission succeeded, new{id= form id}}); The validation method is a method that returns a type of Bool. If returned to false, the form is not committed.
Submit a form with a file, using Html.BeginForm
Html.BeginForm (methods, controllers, formmethod.post,new{id= forms id,enctype= ' Multipart/form-data '});
The form contains a button with the type Submit and a click event for the button (' #ID '). Click (function () {determines the validation event, returns false to stop form submission}); Validation events are also methods that return type bool
Normal commit, no form included
The validation event is judged before it is committed, and return false to stop committing the Data. The validation event is also a method that returns a bool Type.
well, That's all, and finally welcome you to add to the discussion, Welcome to the public attention to the wheat small tease, or search amcdulls, with small tease together progress.
MVC Application Essays