javascript - MVC: Submit on TextBox change -


i have textbox on mvc 4 view, , let user press enter on changing text , call controller's action method. thanks.

here part of view:

@using (html.beginform()) {     <div class="editor">       @html.labelfor(m => m.folderpath)       @html.textboxfor(m => m.folderpath, new { @id = "folderpath", @style="width:500px;" })       @html.validationmessagefor(m => m.folderpath)     </div> 

and part of controller:

[httppost] [multiplebutton(name = "action", argument = "refresh")] public actionresult refresh(edifilemodel edifilemodel) {     if (directory.exists(edifilemodel.folderpath))     {         folderpath = edifilemodel.folderpath;     }     else     {         modelstate.addmodelerror("folderpath", "this folder not exist!");     }     edifilemodel = load();     return view("index", edifilemodel); } 

add submit button...

<input type="submit" value="submit"/>  

inside form.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -