Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I am using visual basic for coding. In my form I have a delete button for deleting a record. Now I want to show a Confirm msgbox using javascript instead of using visual basic.
What is the javascipt code for the msgbox & Where do I insert this code?
try this..
<asp:Button runat="server" ID="btnDelete" Text="Delete" OnClientClick="return confirm("Are you sure you want to delete")" />
If you want in code behind
imgbtn.Attributes.Add("onClick", "javascript:return confirm('Are you sure you want to delete ?');");
Add a comment
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton_Click" OnClientClick ="return confirm('Are you sure to delete ?')" Text="Delete" />
Try this:
<asp:Button ID="btnDelete" runat="server" Text="Delete" OnClientClick="javascript:return confirm('Are you sure you want to delete this record?');" />
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.