0

CallbackUpdateSchema.Callback 中的错误

BC30506 Visual Basic AND ASP.net Handles 子句需要在包含类型或其基类型之一中定义的 WithEvents 变量。打回来

在此处输入图像描述

Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.Xpo.DB

Public Class UpdateSchema
    Inherits System.Web.UI.Page

Dim uow As UnitOfWork

Private Sub Page_Init(sender As Object, e As EventArgs) Handles Me.Init
    uow = XpoHelper.GetNewUnitOfWork
End Sub

Protected Sub CallbackUpdateSchema_Callback(source As Object, e As DevExpress.Web.CallbackEventArgs) Handles CallbackUpdateSchema.Callback
    uow.UpdateSchema()
    uow.CreateObjectTypeRecords()
End Sub

End Class

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="UpdateSchema.aspx.vb" %>

<%@  Register assembly="DevExpress.Xpo.v18.2, Version=18.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"  namespace="DevExpress.Xpo" tagprefix="dx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>   
        <dx:ASPxButton ID="ASPxButtonUpdateSchema" runat="server" AutoPostBack="False" Text="Update Schema">
            <ClientSideEvents Click="function(s, e) {CallbackUpdateSchema.PerformCallback();}" />
        </dx:ASPxButton>
        <dx:ASPxCallback ID="CallbackUpdateSchema" runat="server" ClientInstanceName="CallbackUpdateSchema">
        </dx:ASPxCallback>

    </div>
    </form>
</body>
</html>
4

1 回答 1

0

使用可覆盖的方法 OnInit

https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.page.oninit?view=netframework-4.8#System_Web_UI_Page_OnInit_System_EventArgs_

事件是为用户设计的。对于子类化,您应该改用可覆盖的方法。

Protected Overrides Sub OnInit(e As EventArgs)
   MyBase.OnInit()
    uow = XpoHelper.GetNewUnitOfWork
End Sub
于 2020-01-17T03:34:00.300 回答