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

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

Post by TEFERUYgLS » Sun, 13 Jul 2008 23:27:01


Hello personal gear as I would like to correct this error in ASP.NET MOBILE




Application Server Error in '/ VS2005/NET2.0/AspNetMobile/objectlistbind'.
--------------------------------------------------
------------------------------

Invalid posted date 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 date 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.)


The error happens qdo click on the link command text - Return to list



Below the source and the code-behind the application



source

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
Inherits="_Default" %>
<%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls"
Assembly="System.Web.Mobile" %>
<html xmlns=" http://www.yqcomputer.com/ " >
<body>
<mobile:Form id="Form1" runat="server">
<mobile:ObjectList ID="ObjectList1" Runat="server" BackCommandText="Return
to List"
CommandStyle-StyleReference="subcommand" LabelStyle-StyleReference="title">
</mobile:ObjectList>
</mobile:Form>
</body>
</html>

code-behind

Imports System.Data
Imports System.Data.OleDb
Partial Class _Default
Inherits System.Web.UI.MobileControls.MobilePage
Protected Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Form1.Load
Dim DBConn As OleDbConnection
Dim DBCommand As OleDbDataAdapter
Dim DSPageData As 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()
End Sub
End Class


pd if someone help me now thank you

Translated from Portuguese into English by Google