| > csc /t:library /r:System.Web.Mobile.dll ListAdapter.cs 将这个ListAdapter.DLL复制到你的WAP应用程序bin目录下。 修改web.config来提供control mapping在你的web.config文件中找到mobileControls节点,修改为以下: Web.config中的system.web节点下 <!-- 指定没有 COOKIE 的数据字典类型 这将使字典的内容出现在本地请求 URL 查询字符串中。 这是在没有 Cookie 的设备上进行窗体身份验证所必需的。 --> <!--在您使用像 useRandomID 这样的自定义属性时,必须在您的移动 Web 应用程序中启用自定义属性allowCustomAttributes。 --> <mobileControls allowCustomAttributes="true" cookielessDataDictionaryType="System.Web.Mobile.CookielessData" > <device name="UltraListDeviceAdapters" inheritsFrom="WmlDeviceAdapters"> <control name="System.Web.UI.MobileControls.List" adapter="iUltraMobiles.ListAdapter, iUltraMobiles" /> </device> </mobileControls> device节点就声明了一个新的Adapter,名为“UltraListDeviceAdapters”,这个名字是可以随便定义的。inheritsFrom属性是指。你必须提供控件的fully qualified control class name:“iUltraMobiles.ListAdapter, iUltraMobiles”,control的name属性指的是“你重载的哪一个mobile控件”。 试用新控件现在你已经修改了mobile:list控件的最终渲染方式,在它原本输出的诸多个<a> tag之前抢先输出了你的image的符合wml规范的tag。 这样,你的aspx页面不需要做任何改动,重新编译你的工程后,新的渲染方式就生效了。 你可以在M3gate模拟器上试验。 附录A mobileControls例子:下面给一个比较完整的例子做示范: <!-- Adapter configuration for mobile controls used in the portal --> <mobileControls> <device name="PortalHtmlDeviceAdapters" inheritsFrom="HtmlDeviceAdapters"> <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.HtmlTabbedPanelAdapter,Portal" /> <control name="ASPNetPortal.MobileControls.LinkCommand, Portal" adapter="ASPNetPortal.MobileControls.HtmlLinkCommandAdapter,Portal" /> </device> <device name="PortalChtmlDeviceAdapters" inheritsFrom="ChtmlDeviceAdapters"> <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.ChtmlTabbedPanelAdapter,Portal" /> </device> <device name="PortalWmlDeviceAdapters" inheritsFrom="WmlDeviceAdapters"> <control name="ASPNetPortal.MobileControls.TabbedPanel, Portal" adapter="ASPNetPortal.MobileControls.WmlTabbedPanelAdapter,Portal" /> </device> </mobileControls> 附录B mobileControls属性定义表: mobileControls节点的具体各项属性定义可以参见: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mwsdk/html/mwlrfdevice.asp The <mobileControls> element has the attributes shown in the following table. Attributes of the <device> subtag Description name Specifies the unique name by which you must identify the device 上一页 [1] [2] [3] 下一页 |