Share via


From the January 2002 issue of MSDN Magazine

MSDN Magazine

Navigation, Clickthroughs, Debugging, and More
Edited by Nancy Michell

Q I want to add a number of dropdown boxes to the home page of my company's Web site so users can choose where they want to go from a number of categories (see Figure 1 for an example). What's the best way to implement this?

Figure 1 Navigational Dropdowns
Figure 1 Navigational Dropdowns

A
In general, this is not a good idea. Frequently, such dropdown boxes only show the user one choice at a time. When there are many choices in each list, the user has to scroll up and down and really doesn't get a good picture of what the options are. It's better to create a page for each category, having links for each option displayed. This type of solution is easier to navigate back to, prevents all that scrolling, and shows the user all their options at once.

Q
In my small company, we recently redesigned our e-commerce site to get more visitor traffic. Our hits have gone up about 37 percent. The marketing department says the proof is in the clickthroughs, but I'm not so sure. How can we tell if the design was a success?

A
You may be right—the increase in clickthroughs may not be what you want to look at. It could be the result of something you didn't expect. For example, you may have buried information that your typical users are looking for. One good way to find out is to do a side-by-side comparison of the old site and the new one, counting the actual clicks that it takes to perform a typical, predetermined task on each version of the site. If it takes more clicks to accomplish typical tasks on the new site, your clickthroughs go up, but your user satisfaction goes down.

Q
I'm getting very frustrated trying to adapt a VBScript that runs fine in CScript to run in Microsoft® Internet Explorer. Debugging this is a total nightmare—I'm relying on painfully moving msgboxes throughout the code, trying to determine when it breaks. I'm guessing there are tools for debugging VBScript to run in Internet Explorer, but I don't know what they are. Why would there be a difference between a script that runs in CScript and one that runs in Internet Explorer? I'd like to learn how to adapt the script in a more efficient manner.

A
You're probably having security problems or using the WScript object, which isn't available outside of Windows® Script Host (WSH). Either way, you can easily debug Internet Explorer using Visual Studio® or the script debugger (https://msdn.microsoft.com/scripting). Just set the break at next statement option in the View | Script Debugger menu or put a stop statement at the beginning of your HTML file.

Q
My team is building a new Web site. It seems like every site has its navigation bar on the left, and we thought we'd try something different. Why do so many sites use the same approach?

A
You could certainly use another method of navigation; some sites do. But the reason the majority of Web sites put the navigation down the left-hand column is that it's become something of a standard. By putting it there, you can be relatively sure that users will know where to find it. Remember, studies show that users don't think that searching for navigation is fun and challenging. If you decide to use another model, just make sure you're consistent across all your pages. It's one thing to have a user learn another navigational process when they come to your site; it's another to ask them to learn it again on each new page. On the other hand, you always want your branding to stand out. You don't want users to confuse your site with other organizations like yours. That's a lesson learned years ago in advertising. So, while it's wise to adopt standards, don't copy a look.

Q
I'm working with JScript running inside of Internet Explorer. If a user clicks on the Close button, how do you cancel the event and keep Internet Explorer from closing?

A
People hate going to Web sites where they have to do something drastic like kill a process to shut down Internet Explorer. And besides, you can't prevent Internet Explorer from closing—that would be a security risk. You can return a string from your onbeforeunload event handler, which causes the user to be prompted about whether or not they really want to navigate away from your page (your string is incorporated into the text of the message)—but that's it. Another suggestion is to write a simple app that hosts a WebOC control, then run your JScript there.

Q
What are the choices available to retrieve data from SQL in XML format other than using ADO or OLE DB (ICommand/ICommandStream interfaces)?

A
You can use the SQLXML HTTP access method (which internally uses OLE DB). Other options include the new managed class providers if your program is in managed code (only with the latest SQLXML 2.0 Web release), or the specialized OLE DB provider (only with later SQLXML Web releases) instead of the general SQLOLEDB provider.

Q
We're redesigning my company's Web site. Originally, we rushed and just threw anything up on the Web. Now we want to do it right. What's the first thing we should think about?

A
Whew! That's an easy one. Who are your visitors, and what do they want to do? You have the advantage of having some of that information already because you have a site in operation. The following two questions will guide your efforts.
      Do you sell products? If so, give consumers an idea of the breadth of your product offerings on the home page. You certainly won't list them here unless there are only a few, but you should convey to the user exactly what kinds of products they'll find on your site. Are you a news organization? Think newspaper. Yes, the day's top headlines are on the front page, but not every news story or every headline is there. Overwhelming the reader with too much is equally as bad as suggesting that there is less available at your site than there really is available.

Q
Are DiffGrams positioned to replace the use of OpenXML in stored procedures for inserting, updating, and deleting? Has anyone tested performance on DiffGrams versus OpenXML?

A
DiffGrams and OpenXML solve different problems. In addition, DiffGrams are not a replacement for OpenXML. A DiffGram provides XML-based insert/update/delete semantics and is a persistence format for changes to a dataset in a disconnected scenario. OpenXML provides a rowset view over your XML data.

Q
I am developing a Web Service using SQLXML 2.0. Given that I'm running SQL Server™ in Windows Authentication mode, I create a SqlXmlCommand object like this:

  SqlXmlCommand cmd = new SqlXmlCommand("provider=sqloledb;
  
trusted_connection=true;server=(local);database=foo");

However, upon execution I get an exception that says: "Login failed for user 'SYSTEM'. Reason: Not associated with a trusted SQL Server connection." Coincidentally, I cannot add a SQL Server login for 'SYSTEM,' because it doesn't seem to be a real user.
      Is there a way to utilize SQLXML 2.0 in ASP.NET when SQL Server runs in Windows Authentication mode? Everything runs OK when I switch to mixed mode and pass UserID and password.

A
This is an easy problem to solve. The fix is two parts:

  1. Under <system.web> in web.config add:
         <identity impersonate="true" />
      

    • In your connection string, make sure you have the following which should solve your problem:
           Integrated Security=SSPI
        

Q How does the SQLXMLOLEDB provider compare to the general SQLOLEDB provider in terms of performance?

A
The whole reason for SQLXMLOLEDB is to offer you a simpler and better performing implementation since it only provides the interface components for the XML access.

Q
I want to use onmouseover/onmouseout in combination with a text link and an image. I found several JScripts, but they all begin with a starting image, which is replaced when the mouse goes over the text link. I want the image to appear only when the mouse is on the text link.

A
Here's a quick solution:

  <a href="some.url" onmouseover="this.nextSibling.style.display=
  
'inline'" onmouseout="this.nextSibling.style.display='none'">
my link</a>
<img src="some.gif" style="display:none">

However, this requires there to be no space in the HTML between the anchor tag and the image tag. If you give the image a unique ID, then you can change the this.nextSibling code to just use that ID. Please note that this will work only in Internet Explorer.

Got a question? Send questions and comments to webqa@microsoft.com.

Thanks to the following Microsoft developers for their technical expertise: Zack Birkenbuel, Andrew Clinick, Edward Cutrell, Brian Hanna, Dan Mohr, Dan Ricker, Michael Rys, and Venkat Sunkara.