-1

I have a button like this

<asp:Button ID="btncnclbkng" CssClass="divskyblue" runat="server" Text="CANCEL BOOKING" Enabled="false" Width="410px"  OnClientClick="return checkrecord();"/>

And javascript as below

function checkrecord() 
    {
        if (confirm("Are You Sure")) {
            return true
        }
        else
            return false;
    }

If i remove Enabled="false" from button then it asks confirmation but i adding and removing eneble-disable property of button in javascript after making enable then its not working .Please suggest me how to onclient click property to asp.net button in javascript

Grevling
  • 456
  • 4
  • 18
Mayur
  • 79
  • 1
  • 2
  • 16
  • What does that mean: _"but i adding and removing eneble-disable property of button in java-script after making enable"_? Why would you ask for confirmation if the button is disabled? – Tim Schmelter Oct 14 '13 at 07:31
  • create http://jsfiddle.net/ – Jitendra Pancholi Oct 14 '13 at 07:32
  • Question is not clear. – Jitendra Pancholi Oct 14 '13 at 07:33
  • I guess you are mixing asp.net attributes and html attributes. See this to disable your button client side http://stackoverflow.com/a/13831737/1236044 – jbl Oct 14 '13 at 07:36
  • Take a look at this question http://stackoverflow.com/questions/14058116/confirm-postback-onclientclick-button-asp-net – Hans Derks Oct 14 '13 at 07:36
  • initially my buttons is disabled..If it is not then javas-script given works fine for me on client click..I am making button enable in javascript ..then after how can i add/register my java-script to than button – Mayur Oct 14 '13 at 07:36

1 Answers1

1

Use disabled attribute for your input. As this is a server attribute you can't enable/disable using JavaScript.

JSFiddle

Aditya Singh
  • 9,512
  • 5
  • 32
  • 55