In fact, the above is just how to add code to the sequential method of the expression, the code inside what each function means, how to understand? We need to ponder.
We first to understand: We in the controller is only to HttpGet, httpget understanding is actually the request. Then I want to save, what to do when inserting.
The new action is added to the controller above, of course we want to add new view (new.cshtml), there will be a code in the view.
using (Ajax.beginform ("New", "Datamodule", New ajaxoptions{
Insertionmode=insertionmode.replace,
Httpmethod= "POST"
Onsuccess= "Savesuccess"
},new{@id = "Savepersonform"}
The inside tells us:
NEW: Controller method (not associated with httpget above, need to re-establish a "httppost" new to accept the model and save the data)
Datamodule: Controller name
Onsuccess: It is the method of the JQ of index, the function can change the view data of the main page in time. Looks like no refresh update immediately after saving. It's beautiful.
That's what I'm thinking. How do I press the dialog button, do not close the window, and update the data of the window, the implementation of the dialog box under the page to effect.
Then the paging function of the foreign article is also relatively full, later I can add to the pagination part of the code points to write an article. For the master of the high-level is not necessary, left to the novice beginner to see.
I'm just proposing how to achieve the effect of Ajax changes under the dialog button.
1, we add a paragraph under the dialog box page
<div id= "content555" ></The main purpose of div> is to make this part of the text change.
2, then we in the index of JS in the dialog under the save:fuction to increase the things we want to use, what is. is actually a function of the JQ: (This function needs to understand its function)
$.ajax ({
Type"POST ",
Url:"@Url. Action ("Getaddresslist", "Address")",
Data: {Personno:parpersonno, Pageno:parpageno},
CacheFalse
DataType:"JSON ",
Successfunction (data)
{
if (data. Html)
{
$("#content555"). HTML (data. Html);
Buttonizeall ();
Setlinkabilites ();
Setpagingsummary (Parpageno);
}
Else
{
Alert‘Opps! ');
}
},
Errorfunction (exp)
{
alert (error Address: ' + exp.responsetext ';
}
}); //end Ajax call
Of course it's just that the dialog box can change the text and data changes, A lot of learning needs extrapolate. There is time for me to continue to improve, but to give ideas, everyone to achieve understanding is very important.