Export (0) Print
Expand All

Show Me the Data

As of December 2011, this topic has been archived. As a result, it is no longer actively maintained. For more information, see Archived Content. For information, recommendations, and guidance regarding the current version of Internet Explorer, see Internet Explorer Developer Center.

Kusuma Vellanki and Tom Moran
Microsoft Corporation

We guess it should be no surprise that in the Information Age we get a lot of questions about data—how to mine it, display it, and get users to it (or get it from the users). For September, Kusuma and Tom explore some data solutions, and look at <IFRAME> redirects, colored scroll bars, and the ongoing quest to write once and have that writing work on any platform, in any browser.

Contents

SELECTive data binding—In an XML bind
Down to the Details—Retrieving client data
Color Me Badd—Colored scroll bars
Write Once, Work Everywhere—Cross-browser development

The Web Team in Short

SELECTive Data Binding

Dear Web Team:

Hi.

I have a big problem. In my Web page I need to have two list boxes that are to be filled by XML data. When I change selection in one list box, I need the data in the other list box to be changed, too. How do I do this?

P.S. I would like to use the DATASRC to fill my list box options:

<SELECT DATASRC="#xmldso" DATAFLD="CUSTOMER">
.... AND CREATE OPTIONS HERE!!!!!!
<SELECT>
like you can do with a table
<TABLE DATASRC="#xmldso">
<TR>
<TD><SPAN DATAFLD="CUSTOMER"></SPAN></TD>
</TR>
</TABLE>

Regards,

Peter

The Web Team replies:

Peter, what you want to achieve implies changing the default data binding behavior of the select box (changing the value of the field in the current row of the recordset to which the select box is bound). Because data binding is meant to be transparent to the user anyway, we thought, Why ever not? We cooked up these samples for you.

The first sample shows the original behavior that you wanted to override, and the second sample shows how to change the current recordset row so that the other data-bound elements, such as select boxes and spans, show the value of the new row. The solution was to keep track of the previously selected index in the select box—then in the onchange event, reset it back to the old index so we didn't change the value of the current row in the recordset. We then moved the AbsolutePosition property of the recordset to the new selection index requested by the use.

With respect to your second question, there is no easy, built-in solution. Once the ondatasetcomplete event fires, you have to iterate through the recordset and populate the select box. This brings us to our third sample. For kicks, we tried to mimic the select box behavior by using a table that would be populated automatically. The code for this is more complicated than iterating through the recordset, but we had fun writing this up, so we decided to share it. Keep in mind that the code could be improved (for example, it could use behaviors).

For more information on data binding, see the Data Binding section.

Down to the Details

Dear Web Team:

I need to get some details, such as ParentFolder, Size, etc., and it doesn't seem that the FileSystemObject supports this. How can I get to this information for my projects? I'm using VBScript.

Greg Anderson

The Web Team replies:

You'll want to use the shell object, which is documented on MSDN Online. We've gotten you started with some quick sample code.

Set oShell = CreateObject ("shell.Application")
Set oFolder = oShell.Namespace ("C:\Winnt")

Column0 = oFolder.GetDetailsOf ("", 0) & "                     "
Column1 = oFolder.GetDetailsOf ("", 1) & "                     "
Column2 = oFolder.GetDetailsOf ("", 2) & "                     "

For each folderItem in oFolder.Items

   Prop0 = oFolder.GetDetailsOf (FolderItem, 0)
   Prop1 = oFolder.GetDetailsOf (FolderItem, 1)
   Prop2 = oFolder.GetDetailsOf (FolderItem, 2)
   List = list & Prop0 & vbtab & vbtab & Prop1 & vbtab & vbtab & Prop2 & vbCrlf

Next

Msgbox Column0 & Column1 & Column2 & vbCrlf& vbCrlf & List

The output of this certainly isn't glamorous, but we think you'll get the idea. If you don't, let us know, and we'll see what we can do.

Color me Badd

Dear Web Team:

Hi, I was wondering what in the world is the HTML to make colored scroll bars in Interent Explorer 5.5., e.g., http://www.whirlpool.net.au/.

Thanx

DarkScreamz

The Web Team replies:

More code coming right along your way! These effects are achieved using the scroll-bar style properties. We've made an HTML sample that demonstrates the effect of each scroll-bar style property. The text in the TEXTAREA shows the scroll-bar style that was applied. Refer to the properties of the style object for more information.

Write Once, Work Everywhere

Dear Web Team:

How can I know which features run in which browser? How can I write Web pages compatible with both Netscape and Internet Explorer?

Thanks,

Satyam Tuttagunta

The Web Team replies:

Ah, the question that keeps popping up over and over. We've pulled together a list of sites that have good documentation regarding cross-browser scripting. Some of these sites are especially useful, because you can submit your page and obtain a report regarding incorrect markup, as well as information on what will and will not work in Internet Explorer and Netscape Navigator. For a start, try:

The Microsoft and Netscape sites host documentation that explains their respective browsers' object models, so you can research specific tags, styles, and so forth.

The DHTML References section has complete information about all the tags, attributes, objects, methods, properties, and styles—including which version of Internet Explorer first supported them.

Netscape's object model documentation is available at http://webmaster.info.aol.com/dom.html.

For scripting references, refer to the Windows Script Technologies site and http://developer.mozilla.org/en/docs/JavaScript.

The Web Team in Short

Q: We have had quite a few questions regarding flushing the Authentication credentials Internet Explorer caches during a session to force reauthentication between the client and server without closing the browser.

A: There is no way to do this using script, but you can host an ActiveX control. Refer to Q195192: HOWTO: Clear Logon Credentials to Force Reauthentication.

Q: Jeromy wants to use script to display the Save As dialog box.

A: Use the execCommand method.

<INPUT TYPE=button VALUE="Save this document" ONCLICK="execCommand('SaveAs');">

Q: Bob wants to right-justify numbers displayed in INPUT boxes by writing a parsing function that pads a number with leading spaces " ". But he's having problems, because Internet Explorer 5.5 uses a variable-width font, and his code depends on fixed-width characters.

A: The text-align attribute for INPUT is supported from Internet Explorer 5 onward, but for older versions you can explicitly set the font for the INPUT element to a fixed-width font.

Q: Chris wants users to be able to download his Excel documents instead of having them open directly in Excel.

A: You can send the Content-Dispostion:attachment header for those files, though there are some known issues with this. Your only other option is to use a control that displays the Save As dialog and downloads the file from the server to that location using UrlDownloadToFile. Refer to Q244757: HOWTO: Download a File Without Prompting for sample code in Visual Basic.

Q: Kris wants to build a tree control.

A: See the TreeView documentation.

Q: Malcolm wants to force formfeeds into a Web document so that page breaks occur at designated locations when printing a long Web page from Internet Explorer 4.x and later, or from Netscape Navigator.

A: Refer to the page-break-before attribute and pageBreakBefore property and the page-break-after attribute and pageBreakAfter property. You can also find out which elements support these properties in which version of Internet Explorer, and how these properties relate to the cascading style sheet standards.

Q: Terry wants to get the user name for a user of her ASP application.

A: Try strUser = Request.ServerVariables("Auth_User")

Q: Stephen writes, "You're fantastic. Your site is just excellent, pity it's not a fortnightly issue rather than a monthly one. Great job any way :-)"

A: We think we're going to blush.

The Web Team

Heidi Housten is on the MSDN Architectural Samples team. She came to MSDN from the Internet Client team at Microsoft Developer Support. She is convinced that her 14 years of living and working in England were just preparation for the gray and drizzle of Seattle.

Rafael M. Muñoz, when not playing or coaching his favorite pastime (volleyball), provides technical assistance as a full-time developer support engineer for Microsoft Developer Support.

Thomas Moran, when not struggling to maintain some semblance of sanity (working with Rafael certainly doesn't help), toils with a prodigious team that creates articles and other content from Microsoft's Developer Support.

Kusuma Vellanki is one of the few people who like winters in Washington state more than summers. When not working as a Developer Support Engineer for the Internet Client team, she can be found torpedoing out of control down the ski slopes.


  
Show:
© 2014 Microsoft