Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem with Rules object during save on a postback
Message
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
ASP.NET
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MySQL
Divers
Thread ID:
00987178
Message ID:
00988079
Vues:
39
For some reason this post was lost (from earlier in the day). Here is the listing from the code behind page of the StatesMaintenance.ASPX. It's pretty simple ... like I said before, this only begins to break when the IsPostBack code is implemented along with the code in the StatesRule.vb program. The code to which was posted in another message.
Public Class StatesMaintenance
    Inherits OakLeaf.MM.Main.Web.UI.mmBusinessWebPage

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents grdStates As OakLeaf.MM.Main.Web.UI.WebControls.mmDataGrid
    Protected WithEvents cmdAddState As OakLeaf.MM.Main.Web.UI.WebControls.mmButton

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region
    Protected oStates As States

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Me.oStates = CType(Me.RegisterBizObj(New States), States)

        If Not IsPostBack Then
            Session("dsStates") = Me.oStates.GetAllStates()
        Else
            Dim dsStates As DataSet = CType(Session("dsStates"), DataSet)
            Me.oStates.SetCurrentDataSet(dsStates)
        End If

    End Sub


    Private Sub grdStates_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdStates.DeleteCommand

        Dim RowToDelete As Integer = e.Item.ItemIndex
        Dim dsStates As DataSet = CType(Session("dsStates"), DataSet)
        Me.oStates.Delete(dsStates, RowToDelete)
        Me.BindControl(Me.grdStates)

    End Sub

    Private Sub grdStates_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdStates.EditCommand
        Me.grdStates.EditItemIndex = e.Item.ItemIndex
        Me.BindControl(Me.grdStates)

    End Sub

    Private Sub grdStates_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdStates.UpdateCommand
        Me.grdStates.EditItemIndex = e.Item.ItemIndex
        Dim dsStates As DataSet = CType(Session("dsStates"), DataSet)
        Me.Save(Me.oStates, dsStates)
        Me.grdStates.EditItemIndex = -1
        Me.BindControl(Me.grdStates)

    End Sub

    Private Sub cmdAddState_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAddState.Click

        Dim dsStates As DataSet = CType(Session("dsStates"), DataSet)

        Me.oStates.NewRow(dsStates, Me.oStates.TableName)
        Session("dsStates") = dsStates
        Me.grdStates.EditItemIndex = dsStates.Tables(Me.oStates.TableName).Rows.Count - 1
        Me.BindControl(Me.grdStates)

    End Sub

    Private Sub grdStates_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles grdStates.CancelCommand
        Me.grdStates.EditItemIndex = -1
        Me.BindControl(Me.grdStates)

    End Sub
End Class
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform