[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Redirect after DeleteCommand from FormView

Posted on 2008-10-03
4
Medium Priority
?
604 Views
Last Modified: 2013-11-26
Hello.

I have a page with a FormView control.  I have a linkbutton at the bottom that executes the DeleteCommand for the current record being viewed.  The SQL works when I test it in the expression builder.  What I would like to see happen is for the record to be deleted and for the user to be redirected to another page (which shows all records).  Whenever I put the URL in the PostBackUrl property, the user is redirected but the record is not deleted.  It seems like the redilrection is happening before the delete command.  Any ideas?
0
Comment
Question by:ryanvb83
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 13

Expert Comment

by:joechina
ID: 22634562
At the end of your event which delete the record, add

Response.Redirect("your page shows all records")

PostBackUrl is used to post the form to another page. In your case, you still want to postback to current page, delete the record then redirect.
0
 

Author Comment

by:ryanvb83
ID: 22634613
joechina,

I did not use an event to delete the record.  The LinkButton uses the Delete command which uses the DELETE query in my SQLDataSource.  Should I create an event to handle this?  If so, what type of event?  I already tried that solution in the Click, Command, and DataBinding event but it did not work.
0
 
LVL 13

Accepted Solution

by:
joechina earned 2000 total points
ID: 22634839
In this case, just add a event handler for ItemDeleted event.
0
 

Author Closing Comment

by:ryanvb83
ID: 31502773
That worked.  Thanks!
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question