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
Post a Comment