locked
Objectlist control in mobileforms RRS feed

  • Question

  • User216952109 posted

    Greetings 

    I am developing application using asp.net mobile forms. in that i am in need to diplay the data to the viewer. for that i am using objectlist control to bind the data from databsae and diplay in the mobile screen. for that i am using openwave emultor.

     

    i tried that and it works well in Internet Explorere.all the commands that i created works well.. but when i tried to browse in OpenWave 6.2.2 mobile simulator. i got an error. here i am attcched my coding part and suggest what are the thing i need to change to work well in both browser.

    Source part

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="Default5" %>

    <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

    <html xmlns="http://www.w3.org/1999/xhtml" >

    <body>

    <mobile:Form id="Form1" runat="server">

    <mobile:ObjectList ID="ObjectList1" Runat="server" CommandStyle-StyleReference="subcommand"

    LabelStyle-StyleReference="title" OnItemCommand="click" OnItemSelect="ObjectList1_ItemSelect">

    <Command Name="Edit" text="Edit" />

    <Command Name="Delete" Text="Delete" />

     

    </mobile:ObjectList>
    </mobile:Form><br>

    </br>

    <br>

    </br>

    <mobile:Form ID="Form2" Runat="server">This is fom2<br /><mobile:Label ID="Label1"

    Runat="server">Label</mobile:Label></mobile:Form>

    <mobile:Form ID="Form3" Runat="server">This is form3<br /><mobile:Label ID="Label2"
    Runat="server">Label</mobile:Label></mobile:Form>

    </body>

    </html>

    Coding part 

    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;

    using System.Data.SqlClient;

    public partial class Default5 : System.Web.UI.MobileControls.MobilePage

    {

    Class1 conobj = new Class1();                                 // accessing the class
    protected void Page_Load(object sender, EventArgs e)

    {

    conobj.connect();

    SqlDataAdapter adapter = new SqlDataAdapter("Get_Cust", conobj.conn);            // accessing the stored procedure
    DataSet ds = new DataSet();

    adapter.Fill(ds);

    if (!IsPostBack)

    {

    if (ds.Tables[0].Rows.Count > 0)

    {

    ObjectList1.DataSource = ds.Tables[0];

    ObjectList1.DataBind();

     

    }

    }

     

     

    }

    public void click(object Src, ObjectListCommandEventArgs Args)

    {

     

    if (Args.CommandName == "Edit")

    {

    Label1.Text = Convert.ToString(ObjectList1.Selection[0]);

    Args.ListItem.Value =Convert.ToString( Args.ListItem.Index);

    Label1.Text = Convert.ToString(Args.ListItem[0]);

    ObjectList1.ViewMode = ObjectListViewMode.Details;

    ActiveForm = Form2;

    }if(Args.CommandName == "Delete")

    ActiveForm = Form3;

    }

    }

    While i am executing in ie it works well.

    But in openwave only i got this type of error

     

     

     

     

     

     

     

    Error Report

     

    "Invalid posted data for current ObjectList ViewMode.  (The ObjectList may have been databound on postback during Page_Load, resetting the ViewMode.  Call DataBind in Page_Load only if IsPostBack is false.)"

    kindly do me favour as early as possible

    Thanks

    Friday, February 29, 2008 12:19 AM

Answers

  • User1634317999 posted

    The Openwave emulators are obsolete.

    Update:

    The Openwave emulators versions 6 and 7 do not accept cookies under localhost which causes errors if ASP.NET Mobile Controls are used. A workaround is to use 127.0.0.1 or the machine or computer name as web site address.

    Which emulator should be used to test mobile web applications depends on the target devices and browsers. Device and browser manufacturers provide emulators.

    Examples are:

    Microsoft Device Emulator

    Nokia

    BlackBerry Simulators

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 1, 2008 1:30 AM

All replies

  • User1634317999 posted

    "....  Call DataBind in Page_Load only if IsPostBack is false.)"

    Hello,

    you find the solution of your issue in the error message: Call DataBind only if IsPostBack is false.

    Hope it helps.

    Friday, February 29, 2008 10:26 AM
  • User216952109 posted

    Greetings

                         Thanks for u reply.. i tried that and it works wee in Internet Explorere.all the commands that i created works well.. but when i tried to browse in OpenWave 6.2.2 mobile simulator. i got that type of error. here i am attcched my coding part and suggest what are the thing i need to change

    Source part

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default5.aspx.cs" Inherits="Default5" %>

    <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile" %>

    <html xmlns="http://www.w3.org/1999/xhtml" >

    <body>

    <mobile:Form id="Form1" runat="server">

    <mobile:ObjectList ID="ObjectList1" Runat="server" CommandStyle-StyleReference="subcommand"

    LabelStyle-StyleReference="title" OnItemCommand="click" OnItemSelect="ObjectList1_ItemSelect">

    <Command Name="Edit" text="Edit" />

    <Command Name="Delete" Text="Delete" />

     

    </mobile:ObjectList>

    </mobile:Form><br>

    </br>

    <br>

    </br>

    <mobile:Form ID="Form2" Runat="server">This is fom2<br /><mobile:Label ID="Label1"

    Runat="server">Label</mobile:Label></mobile:Form>

    <mobile:Form ID="Form3" Runat="server">This is form3<br /><mobile:Label ID="Label2"

    Runat="server">Label</mobile:Label></mobile:Form>

    </body>

    </html>

    Coding part 

    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;

    using System.Data.SqlClient;

    public partial class Default5 : System.Web.UI.MobileControls.MobilePage

    {

    Class1 conobj = new Class1();// accessing the class protected void Page_Load(object sender, EventArgs e)

    {

    conobj.connect();

    SqlDataAdapter adapter = new SqlDataAdapter("Get_Cust", conobj.conn);// accessing the stored procedureDataSet ds = new DataSet();

    adapter.Fill(ds);

    if (!IsPostBack)

    {

    if (ds.Tables[0].Rows.Count > 0)

    {

    ObjectList1.DataSource = ds.Tables[0];

    ObjectList1.DataBind();

     

    }

    }

     

     

    }

    public void click(object Src, ObjectListCommandEventArgs Args)

    {

     

    if (Args.CommandName == "Edit")

    {

    Label1.Text = Convert.ToString(ObjectList1.Selection[0]);

    Args.ListItem.Value =Convert.ToString( Args.ListItem.Index);

    Label1.Text = Convert.ToString(Args.ListItem[0]);

    ObjectList1.ViewMode = ObjectListViewMode.Details;

    ActiveForm = Form2;

    }if(Args.CommandName == "Delete")

    ActiveForm = Form3;

    }

    }

    While i am executing in ie it works well.But in openwave only i got that type error.

    Thankyou  

    Friday, February 29, 2008 11:30 PM
  • User1634317999 posted

    The Openwave emulators are obsolete.

    Update:

    The Openwave emulators versions 6 and 7 do not accept cookies under localhost which causes errors if ASP.NET Mobile Controls are used. A workaround is to use 127.0.0.1 or the machine or computer name as web site address.

    Which emulator should be used to test mobile web applications depends on the target devices and browsers. Device and browser manufacturers provide emulators.

    Examples are:

    Microsoft Device Emulator

    Nokia

    BlackBerry Simulators

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, March 1, 2008 1:30 AM
  • User216952109 posted

    Greetings sir

     i want to know if there is any control is available for hand written recognization in the mobile web forms

     

    Wednesday, March 12, 2008 1:08 AM