Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7990559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:03:09+00:00 2026-06-04T13:03:09+00:00

I have a delete Linkbutton in my asp.net form. When the user clicks the

  • 0

I have a delete Linkbutton in my asp.net form. When the user clicks the button it will delete the contents from my db, which has been coded in the OnClick() of the button. But before that I need to have a confirm box which has yes or no options. How do I go about the deletion if the user clicks on “yes” and restrict deletion if user clicks on “no”? My problem is that onclick and onclientclick do not work together. Please help me ..Here is the sample code..

Where do I place the following script?

<script type="text/javascript">
    function Confirm() {
        var confirm_value = document.createElement("INPUT");
        confirm_value.type = "hidden";
        confirm_value.name = "confirm_value";
        if (confirm("Do you want to delete data?")) {
            confirm_value.value = "Yes";
        } else {
            confirm_value.value = "No";
        }
        document.forms[0].appendChild(confirm_value);
    }
</script>

Code Behind:

protected void Mark_Click(object sender, EventArgs e)
{
    a.Delete(name);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:03:11+00:00Added an answer on June 4, 2026 at 1:03 pm

    Use following code:

    OnclientClick="return Confirm()"
    

    Return true/false from Confirm() function, if Confirm() return true then postback will happen otherwise not.

    Refer online sample to test this

    Note:
    We have used Confirm() in upper case because post has user defined function Confirm(). so please don’t confuse with inbuilt function confirm() of java script.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a delete form wherein the user will enter the pnum to be
I have a delete file link on a page: <form id=myForm runat=server> <asp:LinkButton ID=deleteFileLink
I have a delete button on my web site which I want to add
I am using one link button in an asp.net application for delete purpose. For
I have a gridview which is like <asp:TemplateField HeaderText=File Name SortExpression=FileName> <ItemTemplate> <asp:LinkButton ID=lnkname
I have an ASP.NET entry form where several controls have validation set up. The
i have a rad grid with the following code <telerik:GridTemplateColumn> <ItemTemplate> <asp:LinkButton ID=Delete Text=Remove
I have a delete button which I use to delete table rows: //Dialog function
I have a delete button and on clicking cancel on the confirm box, it
I want to have a delete user link in a normal Activerecord table, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.