473,425 Members | 1,670 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Add Confirm Box to Select button

Hi, i would like to ask if it is possible to add confirm box to the select button. I wish to add a confirm box to my code below, pls help...Thank in advance.
Expand|Select|Wrap|Line Numbers
  1. Sub CustomersGridView_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
  2.  
  3.         Dim row As GridViewRow = GridView1.SelectedRow
  4.         Dim str As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " & Server.MapPath("database\db1.mdb")
  5.         Dim conn As New OleDbConnection(str)
  6.  
  7.         If row.Cells(2).Text = "" Then
  8.             Dim mySelectQuery As String = "SELECT State, FileID FROM Table3"
  9.  
  10.             Dim myUpdateQuery As String = "Update Table3 Set State='6' where FileID=" & "'" & row.Cells(1).Text & "'" & ""
  11.  
  12.             Dim myConnection As New OleDbConnection(str)
  13.  
  14.             Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
  15.  
  16.             Dim myCommand2 As New OleDbCommand(myUpdateQuery, myConnection)
  17.  
  18.             Dim retvalue As Integer
  19.  
  20.             myConnection.Open()
  21.  
  22.             myCommand2.ExecuteNonQuery()
  23.  
  24.             Console.WriteLine(retvalue)
  25.  
  26.             Dim myReader As OleDbDataReader
  27.  
  28.             myReader = myCommand.ExecuteReader()
  29.  
  30.  
  31.             While myReader.Read <> 0
  32.  
  33.                 Label1.Text = ("Successfully Approve")
  34.  
  35.  
  36.             End While
  37.             myReader.Close()
  38.  
  39.  
  40.             myConnection.Close()
  41.  
  42.         End If
  43.  
Apr 23 '07 #1
1 1169
Frinavale
9,735 Expert Mod 8TB
Hi there,

I don't see a "select button" in this code.

I'm assuming that you are implementing a web application
You can add JavaScript to a button so that when the user clicks it, a confirm box shows up:
Expand|Select|Wrap|Line Numbers
  1. BTN_Select.Attributes.Add("onclick", "javascript:" + "if(confirm('Are you sure you'd like to select?')==true) {document.getElementById('__Reset').value=True;})
  2.  
You have to make sure that you've registered the hidden form variable "__Reset" so that the JavaScript works properly.
Expand|Select|Wrap|Line Numbers
  1. ClientScript.RegisterHiddenField("__Reset","False")
Then you'll have to check this hidden field's value in your code to see if the Select Button's logic should be done or not.

Hope this helps

-Frinny
Apr 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: J Sahoo | last post by:
I have an asp button on my form. If user clicks the button then my Javascript code Confirm pops up with "Ok" & "Cancel" button. If the user clicks "Ok" from my pop-up then I do my vbMethod...
1
by: freshRecruit | last post by:
Hi, I am having a problem, and is driving me nuts and my deadline is fast approaching. Please do help me.. This is a webapplication with a usercontrol which has some buttons for adding,...
8
by: rn5a | last post by:
I have gone through a no. of posts in this NewsGroup regarding my problem but alas, couldn't come across one which would have helped me in resolving the issue. My problem is this: An ASPX Form...
4
by: mamun | last post by:
Hi All, I have the following situation and am looking for answer in C#. I have a datagrid and putting checkbox next to each record. In the header I have a Delete button. I want users to...
5
by: ahilar12 | last post by:
hi all, i wanted to check whether the password entered matches with the confirm password.either through javascript or through php.i have enclosed my code somebody help on this <html> ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.