473,471 Members | 1,696 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

aspnet confirmation from Client

Hi,

I have a page written in C# asp.net, which allow users to select and
delete records.

Once user selects the record to be deleted, I will confirm with the
user, something like "Are you sure you want to delete the selected
records?"

If yes, I will go and delete the record from SQL. How can this
confirmation and deleting process be done?
>From what I understand, I need javascript to confirm with the user,
but then how can I transfer the response back to the server and delete
those selected records from the server?

Thanks in advance. Your advice and help would be greatly appreciated.

Sep 21 '07 #1
5 1574
<sw**********@yahoo.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...
I have a page written in C# asp.net, which allow users to select and
delete records.
How are the records presented to the user?
Once user selects the record to be deleted, I will confirm with the
user, something like "Are you sure you want to delete the selected
records?"

If yes, I will go and delete the record from SQL. How can this
confirmation and deleting process be done?
<asp:Button ID="MyButton" runat="server" Text="Delete"
OnClick="MyButton_Click" OnClientClick="return confirm('Are you sure you
want to delete this record?');" />
>>From what I understand, I need javascript to confirm with the user,
but then how can I transfer the response back to the server and delete
those selected records from the server?
That's what a postback is for... When the user clicks the above button, a
JavaScript alert will ask them to confirm that they want to continue. If
they don't, nothing further will happen. If they do, the server-side
MyButton_Click event will fire - that's where you write the code to delete
the record...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 21 '07 #2
On Sep 21, 12:35 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
<sweetpota...@yahoo.comwrote in message

news:11**********************@w3g2000hsg.googlegro ups.com...
I have a page written in C# asp.net, which allow users to select and
delete records.

How are the records presented to the user?
Once user selects the record to be deleted, I will confirm with the
user, something like "Are you sure you want to delete the selected
records?"
If yes, I will go and delete the record from SQL. How can this
confirmation and deleting process be done?

<asp:Button ID="MyButton" runat="server" Text="Delete"
OnClick="MyButton_Click" OnClientClick="return confirm('Are you sure you
want to delete this record?');" />
>From what I understand, I need javascript to confirm with the user,
but then how can I transfer the response back to the server and delete
those selected records from the server?

That's what a postback is for... When the user clicks the above button, a
JavaScript alert will ask them to confirm that they want to continue. If
they don't, nothing further will happen. If they do, the server-side
MyButton_Click event will fire - that's where you write the code to delete
the record...

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
The button is setup in the way that you described above. But how do I
get the return value from the server side? What variable does the
return value go?

Sep 21 '07 #3
<sw**********@yahoo.comwrote in message
news:11**********************@y42g2000hsy.googlegr oups.com...
The button is setup in the way that you described above. But how do I
get the return value from the server side? What variable does the
return value go?
What return value are you talking about...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 21 '07 #4
On Sep 21, 1:45 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
<sweetpota...@yahoo.comwrote in message

news:11**********************@y42g2000hsy.googlegr oups.com...
The button is setup in the way that you described above. But how do I
get the return value from the server side? What variable does the
return value go?

What return value are you talking about...?

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
Return value is the actual response from the user, e.g "Yes" to
delete , or "No" (client-side respond)

Since I am going to delete the record from the server-side, is there a
server-side variable that capture the respond from the user (client-
side)?

Sep 21 '07 #5
<sw**********@yahoo.comwrote in message
news:11*********************@50g2000hsm.googlegrou ps.com...
Return value is the actual response from the user, e.g "Yes" to
delete , or "No" (client-side respond)
OnClientClick="return confirm('Are you sure...?');

Note the word "return" before "confirm"...
Since I am going to delete the record from the server-side, is there a
server-side variable that capture the respond from the user (client-
side)?
None is needed - if the user chooses not to continue, the postback doesn't
happen...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 21 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tim Burris | last post by:
At the top here i will put a quick description of my problem followed by the long description. This way you want get bored reading! : short version what is the best/recommended way for ASPNET...
0
by: angus | last post by:
Dear all, I would like to implement something like that: when a user submit a request to get an item from the stock...... it will check the stock in the database if the level of that item is...
3
by: vcornjamb | last post by:
Hello, I am developing a web form that contains some buttons and a data grid which has as its last column link buttons that will delete the data associated with that row. Everything works fine,...
3
by: jimmyfishbean | last post by:
Hi, My client has the following network structure: 2 Windows 2003 servers : Server 1 - Web server running IIS, ftp import and export folder, ASP.NET SOAP web service and asp code on here....
7
by: SK | last post by:
Hi, Would appreciate if anyone could help me on this. Basically my client having few branches across state. And they used Citrix in which to connect to the server side for accessing application...
2
by: radiax | last post by:
I have been trying to find a way for a server to push data to a client (aka disconnected server approach) but iam still stuck. This is the scenario: a client is using a webclient to communicate...
2
by: steggun | last post by:
How To: Popup Confirmation Dialog & Redirect in LinkButton_OnClick Hello All, I have a ASP.NET 2.0 (C#) web form with a LinkButton control. In the server-side code for the LinkButton_OnClick...
0
by: enzo | last post by:
Hi, I have a server checkbox with a "OnCheckedChanged" event. It's works. Then I have add a client confirmation : myCheckBox.Attributes.Add("onClick","javascript:return confirm('mymessage');"); ...
2
by: bienwell | last post by:
Hi all, I still have a problem when using Confirmation box in ASP.NET program. I need to get the value return of YES or NO from confirmation box in Sub function of VB program to do some tasks....
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
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?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.