.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

replacing ok and cancel button of an alert message with YES an NO button in asp.net web application.

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

i want to replace ok and cancel button of an alert message with YES an NO button in asp.net web application.When a user will click yes the data will be saved in the database and if user clicks that will act as a reset button and do not save the data in database and the control will move with as usual to the redirect page.Any pointers will be highly appreciated.I am usin g C# language.

View Complete Post

More Related Resource Links

Displaying a Messagebox with Ok / Cancel button using C# in web application

 Hi all, I would like to get the user's confirmation by displaying a message box with ok cancel options, when you press ok it has to invoke a member function, otherwise other function. thanks. ssm.

How "Call a function" from Message box Ok button and how to add "Cancel button" in Message box


Dear Members,

               I have used the following codings to display the message box.

            StringBuilder sb = new StringBuilder();
            sb.Append("<script type = 'text/javascript'>");
            sb.Append(" Do you want save following records...');");
            ClientScript.RegisterStartupScript(this.GetType(), "script", sb.ToString());

              My requirment is to use the "Ok" button in the message box(alert box).

               I have a function Save().

               I mean if i click on the OK button in the message box, then it should call "Save()"  function.

               And also

               I need to add one more button : Cancel in the message box(alert box)

               Please give a hint.            


How to cancel(disable) combobox in the time is under pressure button?

Hi I have one button and one combobox. How to do so that in time I press the button the combobox turn on be gray or freez. thanks 

Gridview and delete option - Button click displays message

Hi, I have a gridview connected to a sql database that allows the user to delete the record. I used the ASP.net automatic "options" for this. However, I would like when the user deletes a record, a message (textbox) appears in the form to say the record has been deleted. Please can anyone provide some sample codes?   Thanks in advance. Nijojo.

Adding a Cancel Button

Hi, I have an application that performs a very big algorithm when a button is clicked. I'm trying to add a "Cancel Button" if the user wants to cancel the operation. The problem is the cancel button doesn't fire any event while the program is executing another events. Actually it seems beeing inactive. Any idea of how can I solve the problem?

Content cutoff in Print preview screen when a print button is clicked from a WPF application in Dell

Hello, I am facing a problem in printing.. I have a WPf+windows application running on the Dell Mini Net book(10") with screen resolution 1366 x 768. I am trying to the print the page with heading, image & some measurements on a 81/2 x 11. the print preview seem to be ok on the desktop(screen resolution 1440 x 900). but when i run same application in dell mini the layout is cutoff, the text is started from the footer area,  the page is not shown completely.. Can any one help me in this regard??   Thanks for the help in advance Archana

OpenFileDialog OK/Cancel button closes form that opened it


After clicking OK or Cancel from the OpenFileDialog, the calling form gets closed not allowing user to push OK on calling form to save changes.  Strange thing is, if calling form is opened modeless from main form, this does not happen.  But I do not want this form to be left open modeless.

Here's the code:

Main Form opens form to change a file path

    Private Sub AdvancedDatabaseConfigurationToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AdvancedDatabaseConfigurationToolStripMenuItem.Click

        Dim formDBPath As New frmDBPath


    End Sub
formDBPath has a button to browse to new file path which opens the OpenFileDialog
  Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click

    Dim openResult As DialogResult = Me.OpenFileDialog1.ShowDialog(Me)

    If openResult = Windows.Forms.DialogResult.Cancel Then Exit Sub
    Me.txtNewDBPath.Text = Me.OpenFileDialog1.FileName

  End Sub

 When I step through in the debugger, I click OK on the OpenFileDialog, it returns to btnBrowse_Click sub and sets the textbox text, then control passes back to main form sub AdvancedDatabaseConfigurationToolStripMenuI

conditional alert on button click


Hi all:
I have a textbox,listbox and button  enclosed in updatepanel. I want to that if user types something and click the button, if will check in db, if that values exist in db, then it will be added in listbox, otherwise a javascript alert will be shown saying, 'value1' does not exist in database. How can I do this. I tried foloowing code in button click but it is not showing alert.
 String myscript = "alert('I am here');";
 Page.ClientScript.RegisterStartupScript(this.GetType(), "myscript", myscript, true);

how to capture url and show the hyperlink button data output in console application


i have an assignment , i have to capture a url which contain some hyperlink btn,  i have to show the hyperlink btn text and their description

have problem to redirect page , on cancel button click



i am doing simple login page and i used to required field validator to validate user name and password text box.

and there are two buttons submit and cancel.

now i want to redirect this page to home.aspx after clicking on cancel button, but that two required fields validator get pop up and i get stuck in login page.

 if anyone knows how to solve this problem please tell me..

thanks, in advance for your valuable time. 

SharePoint 2010 Central Admin--Create/Extend Web Application button on Ribbon are disabled


My Dev Environment is  SharePoint 2010 on WIN 7. I have 2 users

1) Built in Administrator- Member of FARM Administrator

2) Dinesh02\Dd – Also member of FARM Administrator

Now when I Sign-in with my account and use Manage Web Application link, on the Top Ribbon none of Button is enabled. I can not create Web APP nor Extend it.  When I select web application from list, some button are enabled but not all. Also I can see role as Contributor

This does not happen When I sign-in with Built-in\Administrator account.

Unable to use the button in datagrid of C# Win Application


I have included the column called edit where i added button to that column and i am unable to use that button like button events (onclick).

I were tried for double click on button to go event , but it not showing the button in design view. So please help regarding this...

i am using VS2008-windows application over C#


Code i am used in form2.cs(Which holds the data grid) as follows,

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication1
    public partial class Form2 : Form
        public Form2()

        private void Form2_Load(object sender, EventArgs e)
            // TODO: This line of code loads data into the 'employeeDataSet.mEmpDetails' table. You can move, or remove it, as needed.

Cancel button Invalid page URL

I have created a page using SPD and inserted Custom List form . It has bought me the necessary Controls for each of the columns.
I have a save button which when clicked goes to a ThankYouPage.aspx by applying a queryString Source=ThankYou.aspx when the page is loaded.
My problem is the cancel button which when clicked says invalid URL. So how do I do a cancel button which when clicked goes to a page (as i did with a Save button)

How to Click a Button in another Application Programmatically in C#?


I would like to invoke the button click event from one application to another application. Is there any to way to trigger the other application events from the main application. Please help.


Thanks in advance.

Modal Popup Extender and an Update Panel - "Cancel" Button problem


This should be a quick "yes" answer - I am in the process of creating a very simple test, but I thought I'd ask on here too (also, so other people might be able to find the answer, if they have the same problem).

I have created a modalpopupextender that opens up a panel containing an update panel.  I have a cancel button that is tied into the MPE's [CancelControlID] property and this closes the popup when I click it.  However, if I perform a partial postback within the update panel, the cancel button no longer works.  I have found an example online that seems to imply that the cancel button (and I'm guessing, by association) and the OK button should be outside the update panel.  Does the partial postback break the buttons' client script bindings, and thus should they always be placed outside the update panel?

cancel button causes validation


I have two buttons: Save and Cancel.  I have set CauseValidation = "False" for this cancel button.  But when I click the button for the first time, it still causes validation while it does not cause validation if I click it again. 

I tried to fix it by defining validation group for all validation controls, controls that are validated, and save button.  But still the cancel button would validate when first time it is clicked. 

Could anybody tell me how to fix it?


How to make Dynamic button permament to form though application restarts in vb.net


Hi all,

I am making an application in which i am trying to make buttons on run time and on every dynamic button click  i have open different files.

I am able to do that.

but problem arises, when my application restarts...

i want to make those dynamic button permanent to the form(even if my application restarts).


Kindy if anybody have a simple timy code to perform it.... then please send it to me as i want this to be done on urgent basis for my final year project..

Thanks and Regards;

Nikhil Mahotra

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend