Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with Rules object during save on a postback
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
ASP.NET
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MySQL
Miscellaneous
Thread ID:
00987178
Message ID:
00989345
Views:
36
Hello Charles,

I am not a VB expert by any stretch of the imagination, but I was curious about the return statement in the CheckRulesHook... In VB is "=" used for both assignment and a logical comparitor?

Return Me.ErrorProviderBrokenRuleCount = 0

or should this be:

Return Me.ErrorProviderBrokenRuleCount == 0


I know this is probably not going to fix your problem, but I was curious about the VB syntax.


Thanks,

Gordon



>After working through the Quick Start Tutorial I decided to create a simple maintenance form that creates, reads, updates and deletes a list of states. I used the technique for editing data with a databound grid (with Update/Delete/Edit) buttons embedded.
>
>The editing of existing data works great. When the code at the top of the ASPX form reads as follows
>
>
>Private Sub Page_Load()
>    Session("dsStates") = Me.oStates.GetAllStates()
>End Sub
>
>
>As soon as the code is changed to take into account a postback situation as below:
>
>
>If Not IsPostBack Then
>      Session("dsStates") = Me.oStates.GetAllStates()
>Else
>      Dim dsStates As DataSet = CType(Session("dsStates"), DataSet)
>      Me.oStates.SetCurrentDataSet(dsStates)
>End If
>
>
>The check rules code
>
>
>Public Overrides Function CheckRulesHook() As Boolean
>        Me.ValidateStateName(Me.DataRow("cName"))
>        Me.ValidateStateAbbreviation(Me.DataRow("cAbbreviation"))
>        Return Me.ErrorProviderBrokenRuleCount = 0
>End Function
>
>
>throws the following exception
>
>
>Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
>
>Source Error:
>
>Line 27:
>Line 28:     Public Overrides Function CheckRulesHook(ByVal ds As DataSet, ByVal tableName As String) As Boolean
>Line 29:         Me.ValidateStateName(Me.DataRow("cName"))
>Line 30:         Me.ValidateStateAbbreviation(Me.DataRow("cAbbreviation"))
>Line 31:
>
>
>Anyone have a clue as to how the Rules Object is losing a reference to Me.DataRow() during the process of a SetCurrentDataSet() operation?
>
>Thanks
>
>CT
Gordon de Rouyan
DC&G Consulting
Edmonton, Alberta
Email: derouyag@shaw.ca
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform