Implementing User Assistance

Implementing User Assistance

Several alternatives are available for delivering user assistance with Web applications, including

  • Help in a separate browser window

  • Help in a browser pane

  • Embedding Help

Using a Second Browser Window

The simplest way to provide user assistance on Web pages is by opening a second browser window. To do this, you add a HyperLink control on the Web page where you want to provide assistance. Then you set the Text property of the HyperLink control to an intuitive string such as Help , set the NavigateUrl property to the URL of the help file, and set the Target property to _blank . When a user clicks the Help hyperlink, it opens the corresponding link in another browser window.

This method of displaying user assistance uses the target="_blank" attribute to open help pages in a second browser window. Another method of displaying a second window is by writing JavaScript client-side code. However, users might become confused with multiple browser windows open, and it can be annoying to have the help window overlap the window in which you are trying to do work.

Using the Search Pane

One way to address the problems of using a separate browser window for user assistance is to use the Internet Explorer search pane instead. To use the search pane, you set the Target property of the HyperLink control to _search . The following example shows you how:

  1. Open Visual Studio .NET and create a new blank solution named 315C12 at c:\inetpub\ wwwroot \ExamCram . (You might need to change the directory based on your configuration.)

  2. Add a new Visual C# ASP.NET Web Application project at the following location: http://localhost/ExamCram/315C12/Example12_1 .

  3. Set the pageLayout property of the Web form to FlowLayout . Arrange two Label controls ( lblHeadLine and lblInstructions ), an Image control ( imgDecor ), a TextBox control ( txtRandomNumber ), a Button control ( btnGetRandom ), and a Hyperlink control ( hlHelp ) on the Web form. Set the Text property of the HyperLink control to Help , set its NavigateUrl property to Help.aspx , and set its Target property to _search .

  4. Add code to handle the Button control's Click event, like so:

     private void btnGetRandom_Click(object sender, System.EventArgs e) {     Random r = new Random();     txtRandomNumber.Text = r.Next(1000).ToString(); } 
  5. Add a new Web form to your application and name it Help.aspx . Switch to HTML view and modify Help.aspx as follows :

     <%@ Page language="c#" Codebehind="Help.aspx.cs"      AutoEventWireup="false" Inherits="Example12_1.Help" %> <html>     <head><title>Help</title></head>     <body>     <form id="Help" method="post" runat="server">     <h2>Random Number Help</h2>     <p>The Random number application is designed to generate     random numbers between 0 and 999. Just run the program     and click to get as many random numbers as you would     like. Randomness guaranteed or your money back     (this application is 100% free)!</p>     </form>     </body> </html> 
  6. Build the project and view the results in an external Internet Explorer window. When you click the Help hyperlink on the form, it will open the corresponding link in the search companion window, as shown in Figure 12.1.

    Figure 12.1. You can keep the help text with the application by using the Internet Explorer search pane.

    graphics/12fig01.jpg

Although using the search pane does address the problem of keeping the help with the application, it raises other issues. If your users are sophisticated enough to actually use the search pane (for search, history, or favorites, for example), they might not be pleased at having it hijacked by your application's help pages. Worse, though, is the fact that the _search target is specific to Internet Explorer.

Embedding Help

To avoid the problems with extra browser windows or with the search pane, you might choose to embed the user assistance directly in your Web pages.

To do this, you can use controls such as the Label control and set its text property to the help text that you want to display. You can also programmatically set the Visible property of the control to ensure that users see help only when they want.

This approach for providing user assistance is compatible with all browsers (because the .NET Framework is delivering pure HTML when you show the Label control).

graphics/note_icon.gif

The ToolTip property of the server controls can be used to display brief help strings to the user when he hovers his mouse pointer over a control. ASP.NET renders ToolTips by using the TITLE attribute of HTML control tags.




MCAD Developing and Implementing Web Applications with Visual C#. NET and Visual Studio. NET (Exam [... ]am 2)
MCAD Developing and Implementing Web Applications with Visual C#. NET and Visual Studio. NET (Exam [... ]am 2)
ISBN: 789729016
EAN: N/A
Year: 2005
Pages: 191

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net