html - Auto save a drop down list -


i have drop down list feed back. save data when save button pressed. want auto save drop down list without using save button how can it? here ontroller

    public actionresult selectfeedback(int id)     {         yelloadmindbcontext db = new yelloadmindbcontext();         viewbag.feedback = new selectlist(db.feedback, "feedbackid", "feedbackdrpdown");          return partialview();       }     [httppost]     public actionresult selectfeedback(int feedback, int id)     {         yelloadmindbcontext db = new yelloadmindbcontext();         if (modelstate.isvalid)         {             var temp = db.feedback.find(feedback);             db.savefeedback.add(new savefeedback { loginid = id, feedback = temp });             db.savechanges();             return javascript("alert ('success');");         }         return javascript("alert ('error');");     }     public actionresult displayfeedback(int id)     {         yelloadmindbcontext db = new yelloadmindbcontext();         var feed = db.savefeedback.where(x => x.loginid == id).firstordefault();         if (feed == null)         {             return content("no feed entered");         }         return content(feed.feedback.feedbackdrpdown);     } 

and view

  @model myyello.admin.models.feedback  @{ viewbag.title = "feed back";   }    <h2>add notes</h2>     @using (html.beginform("selectfeedback", "admin", formmethod.post))    {@html.validationsummary(true); <fieldset>     @html.hiddenfor(item => item.feedbackid)     <legend>create notes</legend>     <div class="editor-label">         @html.labelfor(item => item.feedbackdrpdown)     </div>          @html.dropdownlist("feedback")        <p><input type="submit" value="save" id="save" /></p>  </fieldset>   } 

how can save data without using button.

use event focusout in turn auto submit form .

$(this.document).ready(function () {     var form = $("form");      form.submit(); }); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -