锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 英语翻译 / ASP.NET的TODO任务管理系统翻译英文原文
服务方向
ɋ¹¤ׇŜ˽¾ݴ¦m
ɋ¹¤ׇŜƠѵ
kaldi˽¾ޗ¼±¸
СԯזԯӴʶ±�>
ԯӴʶ±𲫗¢
ԯӴʶ±񏶍³
ԯӴʶ±񗫎ŗԼ/a>
kaldi¿ª·¢¼¼˵·�>
ɭ¼�/dt>
Ջ¶¯¿ٖƿ¨ʏλ»�
»�¹¤ɭ¼�/dd>
ɭ¼�ᑵ
Java °²׿ӆ¶¯¿ª·¢
VC++
C#ɭ¼�/dd>
»㲠ºΆƽຯa>
Ƚ¶¯¿ª·¢
技术分类
讨论组翻译
文件共享
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883

锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。”需要全文内容也请联系孙老师。中文译文

To Do List Application in Internet Explorer 6.0

I recently attended an excellent two day ASP.NET workshop given by the folks at Wintellect. After I returned to my desk, I decided I need to write an application using ASP.NET in order to make the things I had learned stick in my brain. This simple application is the result. However, this simple two page web application demonstrates how to use all of the following ASP.NET features:

  • Web controls, including the awe inspiring DataGrid control (I'm not kidding).
  • DataGrid template columns.
  • Web form data binding.
  • Dynamic control creation.
  • View state.
  • Code render blocks.
  • Data binding expressions.
  • Code behind.

In addition to the above, there's also code showing how to do simple ADO.NET actions, using CSS within Web Forms, and I even threw in a little JScript for variety! I used C# as the code-behind programming language, again for the learning experience.
Installation & Setup

I'll start with the installation and setup of the sample code. Microsoft has boasted that ASP.NET applications can be "XCOPY" installed. (If you don't know what XCOPY is, go to a command prompt and type HELP XCOPY.) This is almost true. You can certainly copy an .aspx file to your \inetpub\wwwroot directory, then open it with your browser and have the page execute and display. This is in fact how I started building the application. Very quickly, I found out that I would need to use a debugger to figure out what was going on, so I moved the project inside Visual Studio .NET to get more control, and I never looked back. In a nutshell, here's what you will have to do to install the project files correctly, so that you can build and debug the code with VS.NET:

  1. Unzip the project source into a todo or other directory under your \inetpub\wwwroot directory.
  2. Open up the IIS MMC snap-in, or the Internet Services Manager. Browse to the directory and select Properties. Under the Application Settings section on the Directory tab, click on Create. This makes IIS and VS.NET happy.
  3. Edit the file ToDo.csproj.webinfo and set the URLPath to the correct URL to get to whatever location you stashed the project in for 1.
  4. In the web.config file, set the location of the Microsoft Access database correctly down in the <appSettings> tags (see below).
  5. You must give the local machine ASPNET account Modify, Read & Execute, Read and Write permissions to the file todo.mdb, or you will get the somewhat confusing error message "Operation must use an updateable query" when trying to update entries. Welcome to the world of secure programming!

When you've done this, you should be able to double click on Todo.csproj and open the project in VS.NET. Note that I manually created a Default.htm file that redirects to the ToDoList.aspx file, as I prefer this to adding the default pages to the IIS configuration. This allows you to hit, for example, http://localhost/todo and bring up the application.
Source Code Overview

I'm not going to attempt a soup to nuts ASP.NET tutorial here. I will assume that if you're interested in this sample, you are willing to do your own background reading of the help files. Here, I will just highlight the key points of the code.
First, a word about the database. I've used Access 2000 and ADO.NET to do the data access for the application. This is by far the easiest way to get up and running. I used the OleDbDataAdapter class in conjunction with raw SQL almost exclusively. The following code snippet is common in using ADO.NET and ASP.NET:

string connStr =  ConfigurationSettings.AppSettings["ConnectionString"];
string queryStr = "select  * from Items where id=" + idStr;                    OleDbDataAdapter  adapter = new OleDbDataAdapter(queryStr,  connStr);
DataSet ds  = new DataSet();
adapter.Fill(ds);
                  

Note also that I stored the connection string for the database in the application configuration file, as described in the installation steps. In the web.config file, look for the following section:

  <appSettings> 
  <add key="ConnectionString" 
                    value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=                    C:\Inetpub\wwwroot\todo\ToDo.mdb" />
  </appSettings> 

The main page is ToDoList.aspx. A snapshot is shown at the top of this document. My goals for this page where to show the list of to do items, allow some simple filtering, and to allow add, modify, delete and closure of items. In the code, you can see that it's quite OK to mix ASP.NET web controls with good old fashioned HTML and CSS. In fact, it's Microsoft recommendation that for performance reasons, you don't use a Web Control until you need to generate some content dynamically.主页面是ToDoList.aspx.

友情链接
版权所有 Copyright(c)2004-2024 锐英源软件
统一社会信用代码:91410105098562502G 豫ICP备08007559号 最佳分辨率 1440*900
地址:郑州市金水区文化路97号郑州大学北区院内南门附近