This is a quick response article to the blog reader "V Patel" who asked this question yesterday. Here is the question:
- Passing data from view to controller and
- On button click display the thing from textbox to label.
To answer these quick questions I build a sample web app where the user will register his mobile number to get SMS alerts.
Even when the user tries to post a blank form, the client side jQuery validation prevents it and displays a suitable message, as in:
In addition to all these, you can display the message to the user that you are trying to duplicate the entry or even you can delete the previous entry and take a new entry when duplication occurs intelligently without information to the user.
Now, I would like to share all the code here.
If you wish to delete the previous entry and use the new entry when duplication is detected by the system, use the following HttpPost:
It is very simple so far, like web forms. So, in this article you have seen how I passed the information entered by the user from the view to the controller to check duplication and if a duplicate is found again then the error message is passed back to View.
If you just want to display information entered in the textbox to the label (as in the question) then this is quicker: