Microsoft KB Archive/266152

= PRB: Client-Side Grid DTC Does Not Navigate to Row with Internet Explorer 5 or Later =

Article ID: 266152

Article Last Modified on 5/29/2003

-

APPLIES TO


 * Microsoft Visual InterDev 6.0 Standard Edition
 * Microsoft Internet Explorer 5.0
 * Microsoft Internet Explorer 5.01
 * Microsoft Internet Explorer 5.5

-



This article was previously published under Q266152



SYMPTOMS
For a Visual InterDev 6.0 Grid Design-Time Control (DTC) that has a scripting platform of Client (IE 4.0 DHTML) and row navigation enabled, users who click directly on one of the grid rows from within a Web browser will navigate directly to that row if the client is Internet Explorer 4.x. If the client is Internet Explorer 5 or later, the navigation will not occur.



CAUSE
The Visual InterDev Script Library was written before Internet Explorer 5 was released. The Grid onclick event depends on document.selection.type to return a value of &quot;None&quot;. Starting with Internet Explorer 5, when an HTML table is clicked, document.selection.type returns &quot;Text&quot; instead of &quot;None&quot;. This change causes the Grid onclick event to exit before navigating to a new row.



RESOLUTION
To resolve this problem, you can associate the Grid DTC's onclick event with a custom function by using the following code (note that the Grid DTC in this case is named Grid1):  

function window_onload { Grid1.onclick = Grid1_onclick; }

function Grid1_onclick {   var objDataGrid = event.srcElement; var bFound = false; var nIndexAux = 0; var nIndex = 0; if (document.selection.type != 'None' && document.selection.type != 'Text') return; while ((!bFound) && (typeof(objDataGrid) != 'undefined') && (objDataGrid != null)) {       if (typeof(objDataGrid.navbar) == 'string') return; if (objDataGrid.tagName == 'TR') {           nIndex = nIndexAux; nIndexAux = objDataGrid.rowIndex; }       if ((typeof(objDataGrid._auxID) == 'string') && (objDataGrid._auxID == 'DataGrid')) bFound = true; else objDataGrid = objDataGrid.parentElement; }   if ((bFound) && (typeof(objDataGrid.hiliteAttributes) != 'undefined') && (objDataGrid.hiliteAttributes != null) && (objDataGrid.hiliteAttributes.length)) {       var objRS = objDataGrid._objDataSource;

if ((typeof(objRS) != 'undefined') && (objRS != null)) {           var nPos = objRS.absolutePosition; var nOffset = objDataGrid.pageSize * objDataGrid._curPage; if ((this.colHeader.length == 0) || !this.displayHeader) ++nIndex; if (nIndex != 0) objRS.moveAbsolute(nOffset + nIndex); objDataGrid.focus; }          } } 

Keywords: kbctrl kbprb kbscript KB266152

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.