科技行者

行者学院 转型私董会 科技行者专题报道 网红大战科技行者

知识库

知识库 安全导航

至顶网软件频道基础软件用VS.NET中的Mobile Web Form创建移动网络应用程序(3)

用VS.NET中的Mobile Web Form创建移动网络应用程序(3)

  • 扫一扫
    分享文章到微信

  • 扫一扫
    关注官方公众号
    至顶头条

在这篇文章中,你将学到创建移动网络应用程序的基本步骤。在你可以创建一个Mobile Web Forms 应用程序前,你需要安装Microsoft Visual Studio .NET Beta 2和Mobile Internet Toolkit Beta 2。

作者:51CTO.com 来源:51CTO.com 2007年9月1日

关键字:

  • 评论
  • 分享微博
  • 分享邮件

创建Name.aspx移动网络窗体

<%@ Page Codebehind="Name.cs" Inherits="NameApp.NamePage" Language="C#" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %> <mobile:Form runat="server"> <mobile:Label runat="server">What is your name?</mobile:Label> <mobile:Textbox runat="server" id="NameEdit"/> <mobile:Command runat="server" OnClick="GoCommand_OnClick" Text="Go!"/> </mobile:Form> <mobile:Form runat="server" id="SecondForm" OnActivate="SecondForm_OnActivate"> <mobile:Label runat="server" id="Greeting"/> </mobile:Form>

创建Name.cs 后台代码文件

using System; using System.Web.UI.MobileControls; namespace NameApp { public class NamePage : MobilePage { protected Form SecondForm; protected TextBox NameEdit; protected UI.Label Greeting; private String greetingText; protected void GoCommand_OnClick(Object sender, EventArgs e) { greetingText = "Hello, " + NameEdit.Text + "!"; ActiveForm = SecondForm; } protected void SecondForm_OnActivate(Object sender, EventArgs e) { Greeting.Text = greetingText; } } }

编译Name.cs 文件

  1. 在Name目录中创建一个文件夹命名的扩展名。
  2. 在命令行提示输入下面的代码来编译Name.cs 文件:
  3. C:\Inetpub\wwwroot\Name> csc /r:System.Web.dll /r:System.Web.Mobile.dll _ /target:library /out:bin\NameApp.dll Name.cs

在一个PC、一个Pocket PC或下面列出的任何现在的测试设备,浏览http://localhost/Name/Name.aspx并且测试应用程序。

当前测试的设备

◆Pocket PC

◆Sony CMD-z5 with Microsoft Mobile Explorer

◆Mitsubishi T250

◆Nokia 7110

◆Sprint Touchpoint

◆Samsung Touchpoint

◆Simulator for Microsoft Mobile Explorer version 2.01

◆Simulator for Phone.com UP 3.2

◆Simulator for Nokia 7110

◆Simulator for Phone.com UP 4.0

◆Personal computer with Microsoft Internet Explorer 5.5

结论

Microsoft Visual Studio 开发工具的下一代产品显著地减少了创建移动网络应用程序的复杂性。使用Visual Studio .NET ,你将可以从一个单独的ASP.NET页面,开发面向网络和事实上任何移动设备的应用程序-而不用学习各种各样的不同的标置语言。使用新的,简化了创建继承了对工业标准支持的移动网络应用程序的技术,例如Extensible Markup Language (XML) 和Wireless Application Protocol (WAP),Microsoft将使你可以创建下一代移动网络应用程序。

查看本文来源

    • 评论
    • 分享微博
    • 分享邮件
    邮件订阅

    如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。

    重磅专题
    往期文章
    最新文章