Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In a project, I have a HTML button control in an aspx page. Its click event executes a JavaScript. In some case, I want to change the button's disabled property. I tried to do in my C# code. To do so, I tried to add runat="server" for the button, but got Server Error in "/" Application. How can this problem be avoid? Thanks.
Posted

1 solution

JAVASCRIPT:

C#
<script language="javascript" type="text/javascript">
      function ConfirmOnDelete(SIMCODE) {
          if (confirm("Are you SURE you want to Delete") == true) {
              window.location = "del.aspx?SIMCODE=" + SIMCODE + "&DOIF=" + 7;
              return true;
          }
          else {
              confirm("Info NOT yet Deleted!");
              return false;
          }
      }


html button code

<pre lang="xml"><button id="btndel" value="Delete" class="btn btn-danger" placeholder="Delete" onclick="ConfirmOnDelete('<%# Eval("MobileNo") %>')">Del
                                                            </button>
</pre>



if u find this as ur solution, plz accept it n assign rates, thnx, best of luck.
 
Share this answer
 
Comments
[no name] 22-Jan-14 7:59am    
Abdul: Thanks for your post. However, I could not figure out whether your solution is applicable for my scenario. Thanks anyway.
abdul subhan mohammed 22-Jan-14 9:09am    
can u add complete error, u r getting...

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900