This explanation assumes knowledge of ASP and provides a basic RedBack example. This example first connects to a uObject RBO (Customer) and then preserves the RBO Handle. It then does a read to get some state from the RBO Server. We then re-use the object and open the Employee RBO. So that the state is not replaced in that object. The CustomerMaint RBO is then re-openned, but this time we use the object handle not the class name. This tells RedPages to re-use the current RBO instance and refresh the state. The data displayed on the page is therefore from the original state.
Dim CustId As String Dim Name As String Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Dim custHandle As String Dim sessionID As String Dim obj As New REDPAGESLib.RedObject Dim prop As REDPAGESLib.RedProperty try ' open CustomerMaint RBO obj.Open2("rbexamples", "EXMOD:CustomerMaint", "", "", "") 'preserve the handle and session id custHandle = obj.RBOHandle sessionID = obj.SessionID 'now do a read using customer 1 prop = obj.Property("CustId") prop.Value = "1" obj.callMethod("ReadData") obj.Close() 'now re-use the object on Employee RBO obj.Open2("rbexamples", "EXMOD:Employee", "", "", sessionID) obj.Close() ' now re-open Customer using stored handle. We will then get the state for the RBO obj.Open2("rbexamples", custHandle,"","",sessionID) ' get data from refreshed object from backend without calling method! prop = obj.Property("CustId") CustId = prop.Value prop = obj.Property("Name") Name = prop.Value ' confusing? the point is to show that you can save off the handle ' to a stateful object ' and bring back that stateful object's contents with an open command without ' having to call a method to read the data again Catch ex As Exception 'Set Message label with error message throw ex end try ' the form should now display data for Customer 1 end sub See the rbexamplesnetvb directory to review the page's entire source code. |