Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 20th, 2007, 04:20 AM
Authorized User
 
Join Date: May 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to DarkForce
Default Delete and Response.Redirect?

Hi,
My next Problem is, that as i delete a record via the detailsview, the record deletes but as soon as i call a response.redirect the page redirects but does not delete the record.

Is there an alternative?

thanks

So long
__________________
Ivan
 
Old June 20th, 2007, 08:14 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Your post doesn't entirely make sense. First you say "the record delete" then you say "does not delete the record". Which is it? Is the record getting deleted or not? Is that problem you are still SEEING the data on the page? What page are you redirecting to? Please provide more detail.

-Peter
 
Old June 20th, 2007, 08:27 AM
Authorized User
 
Join Date: May 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to DarkForce
Default

Ok step by step:
1. I want to delete a record with the detailsview.
2. this works

1. I want to delete a record with the detailsview and in the on_click function i use Response.Redirect as the last command.
2 this works not; i get redirected but the record was not deleted




So long
 
Old June 20th, 2007, 09:01 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

It would stand to reason then that the record is NOT getting deleted. From where are you deleting it? A database? Can you verify it's getting deleted by looking at the database and not rely on what the page is showing?

Again, to what page are you redirecting?

-Peter
 
Old June 21st, 2007, 02:01 AM
Authorized User
 
Join Date: May 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to DarkForce
Default

I am using a GridView connected to a SqlDataSCource. With the select option, I can select a specific ticket (the variable is saved in an session object)after this is done, i redirect to a site clled "editticket.aspx" where again i have a view (detailsview) conected to a sqldatabase, where i use the session variable. so in the detailsview i can edit and delete the ticket. As i said,this is possible. But it seems that the sql commands are executed at last. When i use the delete button (on_clickDeleteButton) function and put the 'response.redirect(string url);' at last position the redirect works, but the deletion does not.

Is there a possibilite to delete a specific record out of the sqldatabase in c#?example: SqlDataSource.DeleteSepecificCommand(); <- not a true command just an idea of how it maight look like

So long
 
Old June 21st, 2007, 08:30 AM
Authorized User
 
Join Date: May 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to DarkForce
Default

Ok i have one possible solution for this problem:

First i have to delete the delete command from the sqldatasource in asp source view. Then i have to go to the code file and write the delete command manualy like sqldatasource.deletecommand="DELETE * FROM ....";
Then i execute the delete method on the sqldatasource object like sqldatascource.delete();

thank you

So long





Similar Threads
Thread Thread Starter Forum Replies Last Post
response.redirect sarah lee ASP.NET 1.0 and 1.1 Basics 1 October 27th, 2006 08:57 AM
response.redirect ava_h .NET Framework 2.0 0 October 18th, 2006 10:21 PM
Response.Redirect + Javascript jfergy Classic ASP Basics 2 January 17th, 2006 09:17 PM
response.redirect crmpicco Classic ASP Basics 3 February 9th, 2005 01:50 AM
Response.Redirect dhborchardt Classic ASP Basics 4 June 16th, 2003 05:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.