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 4233400
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:12:56+00:00 2026-05-21T02:12:56+00:00

Hi im looking to find out after I do this: c# div.Attributes.Add(onclick, return confirm_delete(););

  • 0

Hi im looking to find out after I do this:

c#

div.Attributes.Add("onclick", "return confirm_delete();");

javascript:

function confirm_delete()
{
  if (confirm("Are you sure you want to delete this comment?")==true)
    return true;
  else
    return false;
}

It pops up with a message box with yes and no if I press yes how can I add a function into my c# how can I call it?

If yes go to c# code behind

and add in confirm_delete 
if yes was clicked
do this 

I need it so when some one clickes yes I can (from code behind in asp.net c#) add in a method to delete from mysql database.

Just dont know how I refrence to the javascript

public static string confirm_delete()
{

    return something (dont know how to)

}
  • 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-05-21T02:12:57+00:00Added an answer on May 21, 2026 at 2:12 am

    How about this add a button with the clientside click event instead of adding it in the code behind. Check to see if the popup returns true. If you return false it should prevent the server side event from firing.

    <asp:Button ID="btn" OnClientClick="if(confirm_delete()){
    /* post back*/
    }else{
    return false;
    };" OnClick="btnDelete_Click" runat="server" Text="delete"/>
    
    
    
    protected void btnDelete_Click(object sender, EventArgs e)
    {
    
      //run your serverside code if confirm was pressed.
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking for a way to find out the URL of a SWF using
This is a fairly involved bug, and I've tried looking around to find other
Probably a dumb question, but is there a way in JavaScript to find out
Hi I have been looking around for this solution but cannot find it. Have
I have spent many hours looking into this and I still can't find a
I'm looking to find alternatives to Solr from the Apache Software Foundation. For those
I'm looking to find a way to access the .net query string contained in
I'm looking to find records in a table that match a specific number that
I've looking to find a simple recommended minimal c++ makefile for linux which will
I am looking to find a librray that emulates part of the capabilities of

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.