Microsoft KB Archive/194017

= PRB: Setting a Default Value in a Client Listbox DTC =

Article ID: 194017

Article Last Modified on 3/16/2005

-

APPLIES TO


 * Microsoft Visual InterDev 6.0 Standard Edition

-



This article was previously published under Q194017



SYMPTOMS
When you attempt to set a default (selected) value of a Listbox Design-time control (DTC) with the Scripting Platform set to "Client (IE 4.0 DHTML)" and the Row Source set to a Recordset DTC with the Scripting Platform set to "Client (IE 4.0 DHTML)", no default value is set when you use the following code in the Window_onload or Recordset1_ondatasetcomplete events: Listbox1.selectedIndex = 0; -or- Listbox1.selectByText("text");



RESOLUTION
To set a default value in the Window_onload event you must use the following code: Recordset1.advise(RS_ONDATASETCOMPLETE, "Listbox1.selectedIndex=0"); -or- Recordset1.advise(RS_ONDATASETCOMPLETE, "Listbox1.selectByText('text')"); This defers selection of an item until after the Listbox DTC is initialized by the Recordset DTC.



STATUS
Microsoft is researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Behavior
 Open a Visual InterDev Web project with a data connection. Add a new .html page, right-click the page and select properties. Set your Default Scripting Language for client to JavaScript (ECMAScript), and then select OK. Add a Recordset DTC. Add a Listbox DTC and set the Row Source to the Recordset DTC. Select the Script Outline tab. If this tab is not present, from the View menu, choose Other Windows and then select Script Outline.</li> Expand Client Objects & Events, expand Window and double-click the Onload event.</li> A function appears in your editor.</li>  Add the following code to the Onload event: Listbox1.selectedIndex = 0; </li> Right-click in the page and choose View in Browser. Answer Yes to the prompt to save the changes.</li></ol>

RESULT: No default value is set.

Additional query words: kbVisID600 kbDSIASPGrp

Keywords: kbide kbprb kbctrl KB194017

-

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

© Microsoft Corporation. All rights reserved.