Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional 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 September 11th, 2007, 12:27 AM
Registered User
 
Join Date: Sep 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help me get out of this mess

Hi all
I've just recently used aspx, and I've been given this application. I started to use paging, because the datagrid in the application is getting longer and longer.

Initially (before paging) the data is able to be deleted (the delete command acts as a link in datagrid), however since I've started using paging, I was unable to delete the data from the data grid.

My thought was that the delete command in not accessible at all... but I don't know where and which part is wrong.

Appreciate if anyone could help me out.

Code:
'Page Load
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Page.IsPostBack Then

        Else
            daOnbReport.Fill(DsOnbReport1)
            dgOnbReport.DataBind()
        End If
End Sub

'Delete command
Private Sub dgOnbReport_DeleteCommand(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs)
        connDVLPDAISY.Open()

        daOnbReport.Fill(DsOnbReport1)
        Dim key = dgOnbReport.DataKeys(e.Item.ItemIndex)
        Dim dRow As DataRow
        Dim delButton As LinkButton

        Try
            dRow = DsOnbReport1.ONB.FindByONB_ID(key)
            dRow.Delete()

        Catch ex As Exception
            daOnbReport.Fill(DsOnbReport1)
            Response.Write(ex)
        End Try

        daOnbReport.Update(DsOnbReport1)
        daOnbReport.Fill(DsOnbReport1)
        connDVLPDAISY.Close()

        conditionSelected()
        dgOnbReport.DataBind()


End Sub

'paging
Private Sub dgOnbReport_PageIndexChanged(ByVal source As System.Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dgOnbReport.PageIndexChanged

        dgOnbReport.CurrentPageIndex = e.NewPageIndex
        bindgrid()
End Sub

'binding grid after paging
Sub bindgrid()
        Me.OracleSelectCommand1.CommandText = "SELECT STATEMENT"
        daOnbReport.Fill(DsOnbReport1)
        Try
            dgOnbReport.DataBind()
        Catch
            dgOnbReport.CurrentPageIndex = 0
            bindgrid()
        End Try

        dgOnbReport.DataBind()

End Sub
 
Old September 11th, 2007, 06:47 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Place a breakpoint on your Delete Method, is it being reached when you try to delete an item?

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
 
Old September 11th, 2007, 08:14 PM
Registered User
 
Join Date: Sep 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Everything is ok now... thanks to debugging I know that the delete command is not reached.

If u noticed, I forgot to put
Code:
Handles dgOnbReport.DeleteCommand
at the delete command.

But thanks for helping me note the missing handler.

Cheers.






Similar Threads
Thread Thread Starter Forum Replies Last Post
XSLT - xs:dateTime error mess. ajuthani XSLT 3 August 26th, 2008 03:39 PM
7 datagrid mess! Raif ASP.NET 1.0 and 1.1 Professional 3 August 30th, 2004 01:05 PM
image I/O to write methods to mess w/ pxls jfancy Pro VB.NET 2002/2003 2 June 5th, 2004 01:33 PM





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