GIDForums  

Go Back   GIDForums > Computer Programming Forums > .NET Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-Jun-2006, 19:25
Saru Saru is offline
New Member
 
Join Date: Nov 2005
Posts: 13
Saru is on a distinguished road
Red face

Radio button, confirm or a message box


I am having two radio buttons on the page with Yes/No option and a payment received button right next to the radio buttons.
First time when the page is loaded, one of the two radio buttons is selected based on the boolean type field value in the database 0 OR 1.
when the user decides to change the value from yes to No and click the payment received button, I not only want to make changes to the database field but also show a confirm box for the user to be sure and then change the field value.

I am having javascript function in my html page,
I have two radio buttons, and a regular submit button,
In my code behind page i am writing an if statement and want to prompt the confirm box before i make the changes to the data field in the database.

right now when i run the program it changes the value in database, but does not show me the box.

Please help me.
Thanks/Saru
Edit/Delete Message
  #2  
Old 28-Sep-2006, 04:55
Menol_LK's Avatar
Menol_LK Menol_LK is offline
Junior Member
 
Join Date: Sep 2006
Location: Sri Lanka
Posts: 29
Menol_LK is on a distinguished road
Lightbulb

Re: radio button, confirm or a message box


Hi Friend,
I think following code will help you!
I wrote this in C# and this will work in vb.net as well and you can implement the same idea in vb 6 the code will be slightly different but the concept remains the same.


C-SHARP / C# Code:
private void button1_Click(object sender, EventArgs e)
{
   if (MessageBox.Show("Are You Sure?", "Confirm!", MessageBoxButtons.YesNo) == DialogResult.Yes)
   {
       /* perform your database operation here */
       MessageBox.Show("User Clicked on Yes Button");
   }
   else
   {
       MessageBox.Show("The User is Not Sure!");
   }
}
Last edited by admin : 28-Sep-2006 at 06:08. Reason: Please insert your C# code between [csharp] & [/csharp] tags
  #3  
Old 27-Oct-2006, 03:38
erniegerdie erniegerdie is offline
Junior Member
 
Join Date: Feb 2004
Location: England
Posts: 84
erniegerdie has a spectacular aura abouterniegerdie has a spectacular aura about

Re: radio button, confirm or a message box


The above answer is how to do it in WinForms.

To do it in WebForms, the following should be sufficient in your Page_Load:

C-SHARP / C# Code:
yoursubmitbutton.Attributes.Add("onclick", "Are you sure?");
  #4  
Old 22-Nov-2007, 06:39
erniegerdie erniegerdie is offline
Junior Member
 
Join Date: Feb 2004
Location: England
Posts: 84
erniegerdie has a spectacular aura abouterniegerdie has a spectacular aura about

Re: radio button, confirm or a message box


Quote:
Originally Posted by erniegerdie
The above answer is how to do it in WinForms.

To do it in WebForms, the following should be sufficient in your Page_Load:

C-SHARP / C# Code:
yoursubmitbutton.Attributes.Add("onclick", "Are you sure?");

Hmm, was just browsing I thought I would correct myself. The code above should be:

C-SHARP / C# Code:

yoursubmitbutton.Attributes.Add("onclick", "return confirm('Are you sure?');");

 
 

Recent GIDBlogWriting a book by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable radio button and check box shinyhui MS Visual C++ / MFC Forum 2 14-Jul-2008 10:21
Check Status of Radio Button 1221NoSkill MS Visual C++ / MFC Forum 1 23-Apr-2006 09:39
Group Round buttons (radio buttons) toaster FLTK Forum 1 03-Jan-2006 06:57
Help! Some basal questions about MFC xutingnjupt MS Visual C++ / MFC Forum 1 05-Dec-2004 03:38
radio button problem zuzupus MySQL / PHP Forum 1 08-Aug-2003 03:25

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 17:03.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.