Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > aspnet confirmation from Client

Reply
Thread Tools

aspnet confirmation from Client

 
 
sweetpotatop@yahoo.com
Guest
Posts: n/a
 
      09-21-2007
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.

 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      09-21-2007
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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

 
Reply With Quote
 
 
 
 
sweetpotatop@yahoo.com
Guest
Posts: n/a
 
      09-21-2007
On Sep 21, 12:35 pm, "Mark Rae [MVP]" <(E-Mail Removed)> wrote:
> <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) 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?

 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      09-21-2007
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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

 
Reply With Quote
 
sweetpotatop@yahoo.com
Guest
Posts: n/a
 
      09-21-2007
On Sep 21, 1:45 pm, "Mark Rae [MVP]" <(E-Mail Removed)> wrote:
> <(E-Mail Removed)> wrote in message
>
> news:(E-Mail Removed) 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)?

 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      09-21-2007
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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

 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is the aspnet account called "aspnet" for all non-English versions of Windows and IIS? torus@tpg.com.au ASP .Net 7 03-23-2007 04:00 AM
Upgrade from aspnet 1.1 to aspnet 2.0 Gary Nelson ASP .Net 2 10-14-2005 05:16 PM
client confirmation in asp.net angus ASP .Net 0 06-24-2004 02:57 PM
microsoft.public.dotnet.framework.aspnet.webcontrols ,microsoft.public.dotnet.framework.aspnet Alfred Sehmueller ASP .Net Web Controls 0 02-20-2004 02:39 PM
Restricting ASPNET ACLs without breaking ASPNET (newbie-ish) Brian Schuth ASP .Net Security 0 09-08-2003 06:09 PM



Advertisments