locked
Submitting data via link in list box RRS feed

  • Question

  • User-1819217823 posted

    Our mobile pages have a list box on them to contain all the links a user can click, one of these links is the submit link. This all works fine in IE 6&7, as well as pocket IE on mobile 4&5. However, on our CHTML capable phones, e.g. Motorola v365, this does not work.

    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>

    Is it possible to get a link in a CHTML phone to submit the contents of a text box when clicked?

    <o:p> </o:p>

    The following is an example form that I put together to show what we are doing in our forms. I have tested it with all of our custom adapters removed and with our custom adapters. All results the same.

    <%@ Page Language="C#" AutoEventWireup="true" Codebehind="Test.aspx.cs" Inherits="Test" %>
    <%@
    Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly
    ="System.Web.Mobile" %>

    <
    html xmlns
    ="http://www.w3.org/1999/xhtml">
      <
    body
    >
        
    &nbsp;
        <mobile:Form ID="Form1" Runat="server">
    &nbsp;
          <mobile:Label ID="Label1" Runat="server">Label</mobile:Label><br
    />
          <
    mobile:TextBox ID="TextBox1" Runat
    ="server" />
          <
    mobile:List ID="List1" Runat="server" Decoration="Numbered" OnItemCommand
    ="List1_ItemCommand" />
          <
    br
    />
        </
    mobile:Form
    >
      </
    body
    >
    </
    html>

    using
    System;
    using
    System.Collections;
    using
    System.ComponentModel;
    using
    System.Data;
    using
    System.Drawing;
    using
    System.Web;
    using
    System.Web.Mobile;
    using
    System.Web.SessionState;
    using
    System.Web.UI;
    using
    System.Web.UI.MobileControls;
    using
    System.Web.UI.WebControls;
    using
    System.Web.UI.HtmlControls;

    public partial class Test :
    MobilePage
    {
     
    protected void Page_Load(object sender, EventArgs
    e)
      {
        Label1.Text =
    string.IsNullOrEmpty(Request.QueryString["Text"]) ? "Null" : Request.QueryString["Text"
    ];
        List1.Items.Add(
    new MobileListItem("Submit"
    ));
      }

     
    protected void List1_ItemCommand(object sender, ListCommandEventArgs
    e)
      {
        
    if (e.ListItem.Text == "Submit"
    )
          RedirectToMobilePage(
    string.Format("/public/Test.aspx?Text={0}"
    , TextBox1.Text));
      }
    }

    Thursday, May 31, 2007 1:55 PM

Answers

  • User1634317999 posted

    Yes. A second option is to use command controls device specific.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, June 9, 2007 2:15 AM

All replies

  • User1634317999 posted

    With the Motorola v365 - which has an XHTML browser and not a CHTML browser - your mobile page doesn't post back. Therefore the value of the TextBox is not send to the server.

    ASP.NET Mobile Controls always try to detect which device requests the page. Then, if the device is configured, the appropriate mark up is send to it. If the device is not configured and therefore unknown like the Motorola v365 the server sends HTML 3.2 without JavaScript by default. Because JavaScript is used to post back forms with hyperlinks your code doesn't work. CHTML does not allow JavaScript, the Motorola v365 has no JavaScript support and you will not be able to postback with hyperlinks.

    To do:

    • Determine the user agent of your phones which is used by the server to detect the device
    • Check the requests and responses with a HTTP monitoring tool
    • Use the Device Profiling Tool to determine the device capabilities and to configure the device

    If you like to post back the page without JavaScript you can use a SelectionList (SelectType radio)  and a mobile command to submit the page for example.

    Friday, June 1, 2007 2:35 PM
  • User-1819217823 posted

    Thank you for your reply, our end result was to go through the applications and replace the submit links with commands as this seemed to be the most approriate thing to do.

    Thanks
    Wayne

    Thursday, June 7, 2007 2:39 PM
  • User1634317999 posted

    Yes. A second option is to use command controls device specific.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, June 9, 2007 2:15 AM