Click here to Skip to main content
12,948,130 members (66,593 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi guys

I'm new to MVC, so forgive me if this sounds like a silly question:

I am building an application using the template that comes with VS2010 and MVC4 using Razor. My problem is buttons... I have tried
<input type="submit" name="value" value="value" />
<button type="submit" name="value" value="value">Test</button>

but neither of these do anything. No postback screen refresh or anything.

Can anyone tell me what I am missing? It seems like it should be so simple, yet I'm tearing my hair out over this...

As far as I am aware, there should be nothing that would disable these.

Posted 8-Oct-12 10:56am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

How would it works if you never added any handlers to the button events? Everything you can possibly use is ultimately based on button onclick attribute and JavaScript:[^].

Unsy 8-Oct-12 17:17pm
I see. I thought that a submit type button automatically does a postback when clicked with no extra code. I'll look at this. Thanks.
Actually, this is how the postback on a control works: ASP.NET generates HTML with event handler. If you load such page on client size and see it via "View Page Source", you will see what happens on client side, pure HTML + JavaScript.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,344
CHill60 3,275
Maciej Los 2,703
Jochen Arndt 1,935
ppolymorphe 1,795

Advertise | Privacy | Mobile
Web02 | 2.8.170524.1 | Last Updated 8 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100