ERRO DE POSTBACK em codigo Asp.Net Mobile c/ObjectList e Db
11/07/2008
0
Olá pessoal gostaria que me orientassem como corrigir este erro em ASP.NET MOBILE
Erro de Servidor no Aplicativo ´/VS2005/NET2.0/AspNetMobile/objectlistbind´.
--------------------------------------------------------------------------------
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.)
Descrição: Ocorreu uma exceção não tratada durante a execução da atual solicitação da Web. Examine o rastreamento de pilha para obter mais informações sobre o erro e onde foi originado no código.
Detalhes da Exceção: 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.)
O Erro acontece qdo clico no link comand text - Return to list
Abaixo o source e o code-behind da aplicação
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
se alguem pd me ajudar desde já agradeço
Erro de Servidor no Aplicativo ´/VS2005/NET2.0/AspNetMobile/objectlistbind´.
--------------------------------------------------------------------------------
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.)
Descrição: Ocorreu uma exceção não tratada durante a execução da atual solicitação da Web. Examine o rastreamento de pilha para obter mais informações sobre o erro e onde foi originado no código.
Detalhes da Exceção: 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.)
O Erro acontece qdo clico no link comand text - Return to list
Abaixo o source e o code-behind da aplicação
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
se alguem pd me ajudar desde já agradeço
Luizitatiba
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)