adding an ok/cancel confirmation box

Hi, 

 

I am trying to add the ok/cancel confirmation box in my application. The user will search for some records, and if the number of rows returned from the search result is greater than 100, then a confirmation box will be displayed saying that “there are large number of records, do you want to continue”.

 

I do not know the best way to do this. Can you please help me on this?

 

I researched on Google, and it said to add a msgbox in the toolbox. But I can’t see that in my toolbox. I also tried adding that, but didn’t find one.

 

Thanks,

Ashu

 

-1
ash_adi
10/31/2007 4:25:50 PM
asp.net.getting-started 91979 articles. 2 followers. Follow

7 Replies
855 Views

Similar Articles

[PageSpeed] 25

There is no MessageBox control in ASP.NET. You have to use javascript for that. Search for javascript confirmation box.

http://www.tizag.com/javascriptT/javascriptconfirm.php


Thanks,
Max
Let Me Google That For You!
-1
bullpit
10/31/2007 4:56:57 PM

Hi,

Thanks for your reply.

I am now able to create a ok/cancel message box, on a button click event.

If we click “OK”, it displayes that “you selected yes”, else “you selected no”.

But, I can’t understand how to program this, so that it could interact it my c# code. Basically, if a user presses OK, it displayed the datagrid and if the user presses Cancel, then a new search should start.

here is my code behind:

protected void Button3_Click(object sender, EventArgs e)

{

if (!Page.IsClientScriptBlockRegistered("MyScript"))

{

Page.RegisterClientScriptBlock(
"MyScript", "<SCRIPT Language='JavaScript' src='JScript.js'></SCRIPT>");

}

 

Button3.Attributes.Add(
"onclick", "ConfirmationWindow();");

}

 

and this is the javascript file:

function ConfirmationWindow()

{

var result = confirm("Are you sure");

if(result)

{

alert(
'You selected YES');

}

else

{

alert(
'You selected NO');

}

}

I'd highly appreciate your help.

Thanks,

Ashu  

 

-1
ash_adi
10/31/2007 5:17:40 PM

Have you considered using the ASP.NET AJAX Confirm Button control?

http://asp.net/AJAX/AjaxControlToolkit/Samples/ConfirmButton/ConfirmButton.aspx 


My Blog
http://Lspence.blogspot.com

(Please MARK this post as ANSWERED, if you find it helpful)
1
lspence
10/31/2007 8:15:54 PM

Thanks! I'll take a look into that.

1
ash_adi
10/31/2007 8:29:08 PM

hi,

can you please tell me how to use ajax toolkit with asp. sorry, i am very new to asp.net environment.

also, is there any other way to do this.

thanks.

-1
ash_adi
11/1/2007 2:00:50 PM

Install the toolkit on your machine,

Then in visual web developer toolbox, right click and select "add tab "

In your new tab, right click and click "choose items"

 A window opens, click browse and browse to the 'Sample web site' that AJAX installed on you machine, browse the Bin folder, select Ajaxtoolkit.dll and click open.

 

You can now drag the ajax toolkit elements onto your webforms.
 

1
Sleb
11/1/2007 2:10:52 PM

On the main MS AJAX page there are two videos you should look at for getting the AJAX Extensions and Control Tool Kit installed. I would then visit the following link, which will walk you through adapting your existing site to AJAX.

http://www.asp.net/learn/ajax-videos/video-81.aspx

Then have a look at the following link, which covers using the ConfirmButton Extender.

http://www.asp.net/learn/ajax-videos/video-119.aspx

You might want to have a look at the other Getting Started videos as well.

http://www.asp.net/learn/ajax-videos/ 


My Blog
http://Lspence.blogspot.com

(Please MARK this post as ANSWERED, if you find it helpful)
-1
lspence
11/1/2007 2:20:34 PM
Reply:

Similar Artilces:

How to return OK or Cancel in the confirm box
Hi , I had implemented the confirm box by using Javascript in my asp code. How can I check on the condition and perform future task? My code is as follow: confirmedMsg = "Confirmed Merging";javaScript += "\n<script language=\"JavaScript\" type=\"text/javascript\">\n"; javaScript += "<!--\n";javaScript += "confirm('" + confirmedMsg + "')"; javaScript += "// -->\n";javaScript += "</script>\n"; this.RegisterStartupScript("AlertScript", javaScript);   I w...

Confirm Message Box with OK or Cancel option in C#
Hi  All, I have a function call which  results in two conditions(True and False).When the condition is false,I wanted the code to display a message box with the two options (OK and Cancel) and when the user clicks the OK button It should direct to another page. Please anyone help me with the code ( in C# ) to display a confirm message box with this two options.Its urgent. Thanks for your help.     private void button3_Click(object sender, System.EventArgs e) { if (MessageBox.Show("Really delete?","Confirm delete", MessageBoxButto...

In ConfirmButtonExtender,How can i get value of OK
 Hi,I have a problem in  ConfirmButtonExtender.I am using ConfirmButtonExtender and when i run it,it pop up the Confirm Dialog with OK and CANCEL Button.So,I need the value or Id of OK and Cancel Button.How can i do this?Please Help.. By:Vasu Oza  u can capture cancel and ok values by using property and click event of the extender. here goes some handy clue for that. <ajaxToolkit:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="LinkButton"ConfirmText="Are you sure you want to click the LinkButt...

how to call a c# function if user click on ok button of java script confirm box in .net
hi, i have one problem that is i'm adding the new user to database, if that user is already exist in the database one pop up should display with message like 'user already exists are u sure you want to update the role of the user' with 'yes' and 'no ' buttons on pop up, if user click on 'yes' button then it should call edituser() method of c3.net other wise it should reset the selected controls. how to do this using extenal .js file with javascript confirm box   Hi When user click on "Yes" set a asp.net hidden field value to be "t...

System.ArgumentException: Invalid postback or callback argument
I can't figure out why I get this error.  Yes, the error description should tell me but I don't understand it or how to resolve my situation so bare with me.First let me explain the code I have going on.In my PageLoad I have registered this script to the page:  Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "DeleteConfirmation", "function confirmDelete(){if(confirm('Are you sure you want to Delete?')){return true;}else {return false;}}", True)Then, in my DataGrid, I have wired up each ImageButton (that's wrapped in an ...

System.ArgumentException: Invalid postback or callback argument
I can't figure out why I get this error.  Yes, the error description should tell me but I don't understand it or how to resolve my situation so bare with me.First let me explain the code I have going on. In my PageLoad I have registered this script to the page:  Page.ClientScript.RegisterClientScriptBlock(GetType(Page), "DeleteConfirmation", "function confirmDelete(){if(confirm('Are you sure you want to Delete?')){return true;}else {return false;}}", True) Then, in my DataGrid, I have wired up each ImageButton (that's wrapped in...

Getting Start With .net
hi i'm intersted to learn asp.net (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about microsoft.net with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or delphi.net) thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

confirm ,ok, cancel
hi I am using 2 buttons named edit and update. in asp.net and c#. There is one textbox control named "txtSelectionsNew". there is 1 datagrid.,it is having bound column edit i.e push button. when i click edit button in datagrid,the corresponding fields will display into textfiled named txtselectionsnew. at that time i am making readonly for this text control true. after clicking on edit,i'll change that textbox control and i'll do update by clicking on update.for updation i wrote one function. when i click on update button,confirm box will show ok,cancel. for this i wrote javascript c...

Converting classic to .NET 2 code, and .NET gets an error back from ADS?
 For future-proofing, our Internal Phone Directory is being moved onto our AD servers, and obviously we're using LDAP for queries.To get the phoneboook queries working, I adapted the current classic ASP code to use LDAP, and that works fine. However, we're wanting to move these pages to .NET, and that's where the problem comes in. Using the same basic logic from the Classic code (90% of its unchanged) to produce an LDAP query, I get the error  155 Unknown error (0x80005000)This is using the same website, and so the same credentials  - unless aspx pages run und...

Where to start and how did you get started?
Hi, I have had a feeling for a long time to jump into the adds market for some time due to my low income (shooting for the stars) and I don't have anything better to do these days. But I find it really difficult not to give up due to lack of guides (what I can find atleast) and all the hard words which only makes me confused. But I won't give up. Never. Not sure if this is the right place to post this, but I deffinitly would be really greatfull for help getting started. How did you get started? +If there are any teacher that wanna show me the ropes private, I can give payment with ...

How can i stop a screen refresh after clicking "ok" on alert box ? Also how can i get a prompt box up but not in javascript , in the .cs file ?
thanks robby  set a last line in ur function as return false;in cs file u can call the alert likeResponse.Write("<script language='javascript'>alert('hi');</script>");Thanks,Ravi Mark the answer as Answer if it satisfy the need. hi, try this may this will help u.. Page.RegisterClientScriptBlock("key", "<script language=javascript> alert('hiiii');return false;)</script>");Rahul Somwanshi,Software Engineer,Pune, India.If this is a right answer to your question then,do not forgot to ckick on "Mark As ...

How do I get started with AJAX.Net?
Hi All, I'm a seasoned asp.net developer but have not yet ventured into atlas et al.  I prefer books, but will take whatever I can get if it's good and will get me going. Any recommendations? Thx in advance. Jeff try here first http://ajax.asp.net/downloads/default.aspx?tabid=47 then learn from sample and docJames Wu (MIB426).NET is only way to goMCP, MCSE, MCDBA, MCSD, MCAD I find the materials online display features and implementations but are lacking architectural depth, and am seeking more comprehensive resources. By architectural depth, I mean that I cannot watch ...

OK/Cancel Message box
Hi can anyone please tell me the code to include a Confirm Javascript message box in my VB.NET project...Or can some please point me to a website where i can follow an example Many Thanks Below article has info on CLient side messagebox http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/clientsidescript.aspSreedharhttp://www.w3coder.orgweblog http://weblogs.asp.net/skoganti Thank you...

Web resources about - adding an ok/cancel confirmation box - asp.net.getting-started

Confirmation - Wikipedia, the free encyclopedia
A bishop administering Confirmation. Rogier van der Weyden , The Seven Sacraments , 15th century. normally carried out through anointing , the ...

Confirmation - Wikipedia, the free encyclopedia
A bishop administering Confirmation. Rogier van der Weyden , The Seven Sacraments , 15th century. normally carried out through anointing , the ...

Facebook Reportedly Acquires Gowalla, No Confirmation From Either Company
... “most” of its employees and founder Josh Williams over to Palo Alto headquarters to work on Timeline, according to CNN. We could not get confirmation ...

Twitter reactions to the #Fed confirmation
... over Twitter — the last time that a new chairperson was appointed, Twitter wasn’t around. Within half an hour of the milestone confirmation, ...

Senate Confirmation Hearing (200910150008HQ) - Flickr - Photo Sharing!
U.S. Sen. Jay Rockefeller, D-W.Va., Chairman of the of the Senate Committee on Commerce, Science and Transportation, makes a point during the ...

John Kerry Confirmation Hearing: Questioned About Vietnam vs. Current U.S. Policy - YouTube
Secretary of State nominee, a vet who later protested Vietnam, faces questions from Sen. Rand Paul.

Republicans force delay on Hagel confirmation
... answers from US President Barack Obama's pick to head the Pentagon have forced Senate leaders to delay a vote, throwing Chuck Hagel's confirmation ...

Is this confirmation Prince George and Princess Charlotte's nanny is Mary Poppins?
The christening of Princess Charlotte was touted as &quot;modern&quot;. No one told the nanny.

Jurgen Klopp Liverpool, Jurgen Klopp news, Jurgen Klopp Liverpool confirmation
JURGEN Klopp is officially the new Liverpool manager.

Is this confirmation Prince George and Princess Charlotte's nanny is Mary ...
Sydney Morning Herald Is this confirmation Prince George and Princess Charlotte's nanny is Mary ... Sydney Morning Herald There were many ...

Resources last updated: 1/6/2016 10:16:08 AM