Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 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 February 17th, 2006, 03:23 PM
Authorized User
 
Join Date: Feb 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to harrison4411
Default Chpt 6 pg 204-205

I cannot delete the player. If you are outside of season then the player can be deleted it says. The recored is not deleted.

I changed my system date to 2/20/06 and 8/20/06 for testing and created me as a player to delete and my date is 2/17/2006.

Please review and let me know what is missing to delete.
NOTE: I use the WroxUnited and created me then deleted. It deleted all players. I used the dave login account.
My code and yours is:
--------------------------------------------------------------
 Protected Sub DetailsDataSource_Deleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEven tArgs) Handles DetailsDataSource.Deleting
        Dim today As DateTime = DateTime.Now()
        Dim startYear As Integer
        Dim endYear As Integer
        Dim seasonStart As DateTime
        Dim seasonEnd As DateTime

        If today.Month > 5 Then
            startYear = today.Year
            endYear = today.Year + 1
        Else
            startYear = today.Year - 1
            endYear = today.Year
        End If

        seasonStart = New DateTime(startYear, 8, 20) '20th August 8 >> Feb 2
        seasonEnd = New DateTime(endYear, 5, 31) '31 May

        If today >= seasonStart And today <= seasonEnd Then
            e.Cancel = True
            Message.Text = "Cannot delete players during the season"
        Else
            'GridView1.DataBind()
            Message.Text = ""
        End If


    End Sub



 
Old June 10th, 2006, 09:44 AM
Registered User
 
Join Date: Jun 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Wullie
Default

I'm getting problems here as well. It appears that the user is being deleted but the gridview is not being updated. :(

You will find the same problem if you add a new user. To see if your add/delete has worked click on one of the paging numbers at the bottom of the gridview. This will refresh the gridview for you and you will see that the player has been added or deleted (depending on your opreation)

There are only 10 kinds of people.
Those who understand binary...and those who don't!
 
Old June 10th, 2006, 09:52 AM
Registered User
 
Join Date: Jun 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Wullie
Default

I've just worked out the problem here guys. Updating the datagrid within the DELETING event procedure is pointless. After all, the data has NOT YET BEEN DELETED.

To make this example work you need to add another event procedure to handle the DELETED event.


Protected Sub DetailsDataSource_Deleted(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEvent Args) Handles DetailsDataSource.Deleted
        GridView1.DataBind()
    End Sub

This book must be teaching me something eh :)

There are only 10 kinds of people.
Those who understand binary...and those who don't!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chpt 12 Bulk Copy smiller BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 February 13th, 2007 11:25 PM
Chpt 20 - adding a web reference kco1122 BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 12 September 4th, 2006 12:30 PM
Chpt 7 >> Pg 245 >>Try It Out #4-5 harrison4411 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 March 2nd, 2006 06:26 PM
Chpt 6 Why Not Try...template & navigation turtle10 Dreamweaver (all versions) 2 September 23rd, 2004 04:14 PM
Chpt 3 Please Help Me! nmj001 BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 July 24th, 2003 10:52 PM





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