For Ajax Add Page

c# aspt.net controller part

region url for ajax load blank form

  • create async partiaviewresult action method
  • load respective add form in partial view

region url for ajax submit/save

  • Create async JSONResult action method
  • grab/get posted data
  • save them to table
  • if success return json with status true and data with recently added id
  • if fail return json with status false and errmsg with proper message

region url for ajax refresh combobox

  • create async jsonresult action method
  • get data from respective table/database
  • return json with id/value field related to dropdown

JS Part

  • Load Form
    • call refresh/load data for dropdown from refresh url
  • when clicked + button
    • show popup modal box with ajax loading of add form
    • when submit button of add form is clicked
      • validate
      • ajax submit [json
      • onsuccess
        • check result status
        • if true then
          • reload list of data in dropdown box
          • mark selected to recently added one [auto selected]
        • if false show error msg
        • close dialog box
      • on failure
        • show err msg
        • close dialog box

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.