[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.mobile

ASP.NET Mobile - a code error of POSTBACK Asp.Net Mobile /ObjectLi

LADEF - BRAZIL

7/13/2008 11:57:00 PM

Hello staff, to run my application Asp.Net Mobile, with the Object - Object
List, gathering data from a DataBind, the following occurs

A) The application will run it performs and displays the list of items
in Object List normally and click it vai him for the part of the item or
record details of the item normally, the problem is that when you click on
'back' or command 'Return to list' he accuses the following error of postback

Erro de Servidor no Aplicativo
'/VS2005/NET2.0/AspNetMobile/objectlistcsharp'.
________________________________________
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.)
Description: There was an exception untreated during the implementation of
the current web request Examine the tracking of battery for more information
about the error and which originated in the code.


Details of the Exception: System.Exception: 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.)

Error of Origin:
Unhandled exception was generated during the execution of the current web
request The information related to the origin and the place of exception can
be identified using the tracking of Cell exception below
..

Tracking Cell:

[Exception: 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.)]

System.Web.UI.MobileControls.Adapters.HtmlObjectListAdapter.HandlePostBackEvent(String eventArgument) +343

System.Web.UI.MobileControls.ObjectList.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +24
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +11

System.Web.UI.MobileControls.MobilePage.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +77
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +177
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1746

Below I am sending the code-behind of my application and the source of
pagina.Se pd someone help me now thank you

CODE-BEHIND

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.OleDb;

public partial class _Default : System.Web.UI.MobileControls.MobilePage
{
protected void Page_Load(object sender, EventArgs e)
{

OleDbConnection DBConn;
OleDbDataAdapter DBCommand;
DataSet DSPageData = new DataSet();
DBConn = new OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;" +
"DATA SOURCE=" + Server.MapPath("EmployeeDatabase.mdb;"));
DBCommand = new OleDbDataAdapter("Select * " + "From Employee "
+ "Order By FirstName", DBConn);
DBCommand.Fill(DSPageData, "Emps");
ObjectList1.DataSource = DSPageData.Tables["Emps"].DefaultView;
ObjectList1.DataBind();

}
}

Source.aspx

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

<html xmlns="http://www.w3.org/1999/x... >
<body>
<mobile:Form id="Form1" runat="server">
<mobile:ObjectList ID="ObjectList1" Runat="server"
CommandStyle-StyleReference="subcommand"
LabelStyle-StyleReference="title">
</mobile:ObjectList>

</mobile:Form>
</body>
</html>

Translated from Portuguese into English by Google