-
Dec 8th, 2017, 10:02 PM
#1
Thread Starter
Banned
mvc simple button event
I added a button to the view of the contents controller, now how do I write c# code to said button's click event ?
-
Dec 9th, 2017, 09:34 PM
#2
Re: mvc simple button event
You don't. MVC does not work like Web Forms, which is the whole point. Web Forms was created to simulate Windows Forms as much as possible, so a Button has a Click event that you handle in your server-side code much as you would handle the Click event of a Button in Windows Forms. MVC works on a very different paradigm.
I think you probably need to do some reading on how MVC actually works but, in general, you can either submit a form using your button, in which case you'll be posting to a controller action, or you can write some JavaScript code to react to the onclick event of the button on the client side.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|