?
Solved

Redirect after DeleteCommand from FormView

Posted on 2008-10-03
4
Medium Priority
?
600 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

765 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