473,785 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ 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 1589
<sw**********@y ahoo.comwrote in message
news:11******** **************@ w3g2000hsg.goog legroups.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="MyButt on_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...@markNOSPA Mrae.netwrote:
<sweetpota...@y ahoo.comwrote in message

news:11******** **************@ w3g2000hsg.goog legroups.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="MyButt on_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**********@y ahoo.comwrote in message
news:11******** **************@ y42g2000hsy.goo glegroups.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...@markNOSPA Mrae.netwrote:
<sweetpota...@y ahoo.comwrote in message

news:11******** **************@ y42g2000hsy.goo glegroups.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**********@y ahoo.comwrote in message
news:11******** *************@5 0g2000hsm.googl egroups.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
2821
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 apps to call web services that REQUIRE Client Certificates via SSL long version our company has new requirements, all servers must REQUIRE SSL and Server/client certificates i have setup a test Win2003 server to issue certs so i have a full test...
0
882
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 smaller than a certain of amount if so......a confirmation (javascript:confirm('')) will be generated after
3
2794
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, but users have requested a confirmation message pop up so the user can confirm the delete. I can not quite get this to work. Here are the facts: I am working in the Microsoft Development Environment 2003 (Version
3
1609
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. Server 2 - SQL server with database on. Want to store images on here accessed via a share.
7
2525
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 running on ASPNET (C# code behind). Basically, all my form was coded as user control and loaded as component to the IFrame. The problem is when browsing the page, it could not be loaded. and there
2
1698
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 with the aspnet server. Is there a way for a server to send data to a client without a client requesting it?? I know it can be done using sockets but does aspnet provides a way? can a webservice do it?? iam trying to find another solution besides...
2
8996
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 event, I need to do some processing and, if it succeeds, popup a confirmation dialog and redirect to a different page. How can I do this? Here's some pseudo-code:
0
1218
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');"); When I click on myCheckBox the client confirmation works, but the OnCheckedChanged event no. Why?
2
2027
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. For example, I have 2 text boxes and one button. The button will call On_Click event . Sub btnSelect_OnClick(ByVal sender As Object, ByVal e As EventArgs) Dim X as double = CDBL(txtbox1.text) Dim Y as double = CDBL(txtbox2.text)
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9947
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7496
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5380
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4046
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 we have to send another system
3
2877
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.