简体   繁体   中英

Inmage button Onclient click issue vb.net

I am having a web Page. On clicking a button (Savebutton) it should save that changes. But before saving i want to display an warning message. And then save the changes. My current code is displaying the message but even if i click on enter key without clicking on 'Ok' its saving. Can anyone suggest any other solution. I want to use RadWindow for the alert.

My Code for the Image button.

 <asp:Panel ID="SavePnl1" runat="server" Visible="False">
    <div style="width: 100%; text-align: right; margin: 0px; padding: 0px;">
       <asp:ImageButton ID="SaveBtn1" runat="server"
               AlternateText="Save " ImageUrl="~/images/icons/save_sml.png" OnClientClick="saveclick()" />
    </div>
 </asp:Panel>

Javascript:

function saveclick()
  {
      window.alert('Check the users before saving'); 
 }

I tried this link ' Image button OnClientClick() event issue in ASP.net using C# ' but didnt understood it clearly.

Thanks

Adding a dummny button resolved the issue .

<asp:Panel ID="SavePnl1" runat="server" Visible="False">
    <div style="width: 100%; text-align: right; margin: 0px; padding: 0px;">
        <asp:ImageButton ID="SaveBtn1" runat="server"
             AlternateText="Save " ImageUrl="~/images/icons/save_sml.png" OnClientClick="saveclick()" />
   </div>
    <div  style="display: none">
       <asp:Button ID="FinalSaveBtn1"  runat="server" Text=""  />
  </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM