-
ASP.NET Mobile - a code error of POSTBACK Asp.Net Mobile c / ObjectList and DataBind
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.w3.org/1999/xhtml" >
<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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|