Development of the textarea control in mobile Web application (2)

Source: Internet
Author: User
Next, let's discuss how to modify the web. in fact, you can directly modify the machine. but it is generally not recommended that you do this. The best way is to modify only the web related to a web application. config file. step 3: Find the web. mobilecontrols section in config. change to the following:

<Mobilecontrols cookielessdatadictionarytype = "system. Web. Mobile. cookielessdata">
<Device name = "htmldeviceadapters" inheritsfrom = "htmldeviceadapters">
<Control name = "cn. sharetop. model. Comm. multilinetextbox, CN. sharetop. Model"
Adapter = "cn. sharetop. model. Comm. htmlmultilinetextboxadapter, CN. sharetop. Model"/>
</Device>
</Mobilecontrols>

Step 4, of course, is the application. On your ASP page, use this control to declare the prefix, domain name space, and assembly:

<% @ Register tagprefix = "mycontrol" namespace = "cn. sharetop. model. Comm" assembly = "cn. sharetop. Model" %>

Then, add our own multi-line input control on the page:

<Mobile: Form ID = "form1" runat = "server">
<Font face = ""> & nbsp;
<Mycontrol: multilinetextbox id = "mtextbox1" runat = "server" Cols = "20" rows = "6" text = "me"> </mycontrol: multilinetextbox>
</Font>
</Mobile: Form>

OK. Now you use IE to access this web application and you will find that this control is correctly parsed into <textarea>. so far, our work has been half done. but now you will find out why the access via mobile phone is not changed at all. It is still a single-line Input <input> ,...... I tried two WAP simulators, openwave 7 and openwave 6.2, and Nokia 6680 and Samsung x859, and I couldn't get the desired results... as can be seen from the simulator, in openwave 6.2, the contenttype returned by IIS is application/XHTML-XML, while in openwave 7, text/vnd is returned. WAP. WML ..... strange... I am stuck at this point. the configuration of config is not familiar, and all the items in it are stuck in the stage of "knowing, not knowing why... no way, so I had to Google again... deviceupdate is installed on my machine. 4. to locate the problem, I open deviceupdate4.config and machine. config two files... after careful research, I understand a rough idea... in the web. the device segment added in config contains an inheritsfrom = "htmldeviceadapters". I started to think that this is a class, but the result is not found in msdn... it was originally defined in machine. A section in config... note: I am now using web. the htmldeviceadapters device defined in config comes from machine. htmldeviceadapters in config... the implementation of various controls is defined in htmldeviceadapters .... in the machine. in config, I found a lot of XHTML-related content, which is added to update 4. Since IIS returns the XHTML type to openwave 6.2, the problem is probably located here, I should add a new device for XHTML so that it can also find the new control I have defined. the configuration is changed to the following: <mobilecontrols cookielessdatadictionarytype = "system. web. mobile. cookielessdata ">
<Device name = "xhtmlldeviceadapters" inheritsfrom = "xhtmldeviceadapters">
<Control name = "cn. sharetop. model. Comm. multilinetextbox, CN. sharetop. Model"
Adapter = "cn. sharetop. model. Comm. htmlmultilinetextboxadapter, CN. sharetop. Model"/>
</Device>
<Device name = "wmldeviceadapters" inheritsfrom = "wmldeviceadapters">
<Control name = "cn. sharetop. model. Comm. multilinetextbox, CN. sharetop. Model"
Adapter = "cn. sharetop. model. Comm. htmlmultilinetextboxadapter, CN. sharetop. Model"/>
</Device>
<Device name = "htmldeviceadapters" inheritsfrom = "htmldeviceadapters">
<Control name = "cn. sharetop. model. Comm. multilinetextbox, CN. sharetop. Model"
Adapter = "cn. sharetop. model. Comm. htmlmultilinetextboxadapter, CN. sharetop. Model"/>
</Device>
</Mobilecontrols> defines three device sections, which are from htmldeviceadapters, xhtmldeviceadapters, and wmldeviceadapters. These three devices use the multilinetextbox control we have defined... finally, I correctly saw the expected results on both the simulator and my x859 .... now, IIS allows HTML devices, XHTML devices, and WML devices to use this custom control... however, there is another question: Why can't I still display my Nokia 6680? Continue. In deviceupdate4.config, I found the device definition for Nokia mobile phones, which is 3650 but not 6680. This is easy to handle. Let's change it. In fact, the two mobile phones are similar to each other on the s60 platform, the screen is also big... so I added a 6680 device, and the content is the same as that of 3650... OK. I can see this multi-line input box in Nokia 6680... in the same way, why can the WML of openwave 7 be modified in this way... but I didn't do it, because I need a WML device. in the process of solving this problem, I took some detours .... remember to warn yourself !!! 1. when I found that IIS returned WML, I tried to let the adapter of this control directly derive from wmltextboxadapter, and modified the web. inheritsfrom in config is wmldeviceadapters, Which is successful in openwave 7. So I want IIS to output WML for all devices... it's too straight... I set pageadapter to wmlpageadapter... result IE is accessed. When a download dialog box is displayed ,.... haha .... 2. I always thought that I could force the output type in the Code and found that it was not working. IIS judges the device and responds to the appropriate contenttype, which does not need to be controlled by the Code, configure all the configurations in the two configurations (but these two configurations are too complicated )......

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.