views:

80

answers:

2

Hi All,

In my application i need to disable the button once it is clicked so that user should not click more than once. APplication is MVC ASP.NET i have done this in normal asp.net application. I tried below lines of code but its not working

thanks in Advance

edited How can i implement this using javascript ?

+1  A: 
<button type="button" onclick="this.disabled = 'disabled';">Click Me!</button>

Although the Button web control renders as a submit:

<input type="submit" onclick="this.disabled = 'disabled';" value="Submit" />
Yuriy Faktorovich
sorry but it wont work in MVC application. you can do it in ASP.NET application but not in MVC
prakash
@prakash: Both of these methods will work, regardless of ASP.NET or ASP.NET-MVC. Can you post what you've tried that doesn't work?
Yuriy Faktorovich
No Did you try in MVC ASP.NET it won't work please check
prakash
A: 

@prakash have you used jQuery to disable or even hide the button?

If your button's id is say "btnClickMe" then the following jQuery will do the job.

$("#btnClickMe").hide();

You could also set the disbaled attribute using jQuery;

$("#btnClickMe").attr("disabled","disabled");

The one above is untested but should work.

griegs
Nup its not working .. its disabling the button but form is not submitting
prakash