MPe*_*ier 11 vb.net asp.net user-controls ascx
我在ASP.NET中有一个自定义控件(后面的代码中的VB.NET),用ASCX定义:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="MyControl.ascx.vb" Inherits="Mynamespace.Controls.MyControl" %>
<!-- some html and other custom controls-->
Run Code Online (Sandbox Code Playgroud)
在代码背后:
Namespace Controls
Public Class MyControl
Inherits System.Web.UI.UserControl
Run Code Online (Sandbox Code Playgroud)
这是在库中设置的.另一个项目在页面中使用该控件:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="mypage.aspx.vb"
Inherits="myproject.mypage" culture="auto" meta:resourcekey="Page" uiculture="auto"
Transaction="RequiresNew" MasterPageFile="Mynamespace.Master"
Theme="ThemeBase2" StylesheetTheme="ThemeBase2" %>
<%@ Register tagprefix="Controls" tagname="MyControl" src="../Controls/MyControl.ascx" %>
<%-- some asp.net --%>
<Controls:MyControl ID="mycontrol1" runat="server"
MyCustomProperty="value" />
Run Code Online (Sandbox Code Playgroud)
但是,当我构建时,我得到一个错误说
'MyCustomProperty'不是'System.Web.UI.UserControl'的成员.
在designer.vb页面中,我看到:
Protected WithEvents mycontrol1 As Global.System.Web.UI.UserControl
Run Code Online (Sandbox Code Playgroud)
我如何确保它成为:
Protected WithEvents mycontrol1 As Global.Mynamespace.Controls.MyControl
Run Code Online (Sandbox Code Playgroud)
?
| 归档时间: |
|
| 查看次数: |
569 次 |
| 最近记录: |