PRB: Visual InterDev 6.0 Grid DTC Invisible After a Roundtrip to the Server

ID: Q232324


The information in this article applies to:
  • Microsoft Visual InterDev, version 6.0


SYMPTOMS

In certain scenarios, you may find your Grid Design-Time Control (DTC) disappears unexpectedly when you click the Recordset Navigation button or the Page Navigation button. This happens most frequently when calling parameterized queries or stored procedures and displaying the results using the Grid DTC. The Grid DTC may disappear after a roundtrip to the server.


CAUSE

This behavior is due to a state preservation problem of the Grid DTC Script object. Within the Script Library, the _DG_Display() function is used to display the user interface (UI) of the Grid DTC on the page. After the Active Server Pages (ASP) page makes a roundtrip to the server, the Recordset DTC, which the Grid DTC is bound to, may be lost. In these cases, the objRS._isEmpty() function returns true when called by the _DG_Display() function. As a result, no table is being written to the page.


RESOLUTION

You can work around this problem by adding the following code to manually reopen the Recordset DTC in the thisPage_OnEnter() event handler:


Sub thisPage_OnEnter() 
   If Recordset1.isOpen() Then 
      Recordset1.close 
   End If
   Recordset1.open
End Sub 
NOTE: If you are passing a value programmatically to the Recordset DTC, you need to re-specify the SQL Text or the parameters in this event handler before opening the Recordset.


MORE INFORMATION

Steps to Reproduce Behavior

Use the following steps to build a sample to call a parameterized query against the SQL Server "pubs" database and demonstrate how the Grid DTC can disappear unexpectedly.
  1. Add a Data Connection to a project that connects to the SQL Server pubs database.


  2. Add a new ASP page to the project.


  3. Drag a Recordset DTC onto the page.


  4. Use the following SQL statement for the Recordset DTC:
    
    "SELECT * FROM authors WHERE au_lname = ?" 


  5. Specify Textbox1.value in the Value field of the Parameters tab of the Recordset DTC.


  6. Clear the Automatically open the Recordset option under the Implementation tab of the Recordset DTC.


  7. Drag a Textbox DTC, Button DTC, and a Grid DTC onto the page below the Recordset DTC.


  8. Bind the Grid DTC to Recordset1 and display the au_lname field.


  9. Add the following code to the Button1_OnClick() event handler:
    
    Sub Button1_OnClick() 
       If Recordset1.isOpen() Then
          Recordset1.close
       End If
       Recordset1.open
    End Sub 


  10. Open the page in browser, type Smith in the textbox and click Button1. You should see that the Grid DTC is now populated with data.


  11. Click on one of the navigation buttons. The Grid DTC is no longer visible.


Additional query words:

Keywords : kbCtrl kbDatabase kbVisID600 kbGrpASP
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: October 7, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.