Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 21st, 2008, 04:38 AM
Authorized User
 
Join Date: Apr 2008
Location: , , .
Posts: 25
Thanks: 0
Thanked 1 Time in 1 Post
Default DetailsView Cancel button to redirect

Hi! I want the detailsview cancel button to redirect the page into another page. What is the event to configure so that the response.redirect statement can be inserted?



  #2 (permalink)  
Old June 21st, 2008, 06:22 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

There are a few ways to do this:

1. Handle the ItemCommand of the DetailsView and then check e.CommandName:

protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e)
{
  switch (e.CommandName)
  { .. }
}

2. Convert the CommandField into a TemplateField and then manually wire up the Cancel button to a Click handler in the code behind.

Hope this helps,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
  #3 (permalink)  
Old June 22nd, 2008, 10:57 PM
Authorized User
 
Join Date: Apr 2008
Location: , , .
Posts: 25
Thanks: 0
Thanked 1 Time in 1 Post
Default

I have used the 2nd option and I implemented:

Dim Linkbutton2 As LinkButton = _ CType(DetailsView1.FindControl("LinkButton2"), LinkButton)

Linkbutton2.<What should I insert here?> = String.Concat("CustomerInsert.aspx?EmployeeID=", Request("EmployeeID"))

What should I insert there?

Thanks

  #4 (permalink)  
Old June 22nd, 2008, 11:02 PM
Authorized User
 
Join Date: Apr 2008
Location: , , .
Posts: 25
Thanks: 0
Thanked 1 Time in 1 Post
Default

I have implemented another way:

<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"
OnClick="Cancel_Sub" CommandName="Cancel" ext="Cancel"></asp:LinkButton>


Protected Sub Cancel_Sub()
        Response.Redirect("CustomerView.aspx?EmployeeID=" & Request("EmployeeID"))
    End Sub

  #5 (permalink)  
Old June 23rd, 2008, 01:23 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Yes, that's the solution I had in mind as well....

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paramater value cancel button errors REVNED VB How-To 1 September 2nd, 2008 01:23 PM
How to stop file uploading when a cancel button coolcoder2007 ASP.NET 2.0 Basics 0 October 26th, 2007 04:21 AM
Moving the new/insert button on DetailsView jpullam ASP.NET 2.0 Basics 3 September 27th, 2007 05:29 PM
Button on GridView that goes to DetailsView AndrewD ASP.NET 2.0 Basics 0 November 30th, 2005 11:09 AM
Problem with cancel and next button in form method Access VBA 0 June 18th, 2005 02:11 PM



All times are GMT -4. The time now is 03:57 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.