请教页面向用户控件传递参数的问题
控件页面
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="Bbshot10.ascx.vb" Inherits="Nill.ZL.Car.Bbshot10" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
控件源码
Public Class Bbshot10
Inherits System.Web.UI.UserControl
Private myiPar As Integer
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Public Property piPar() As Integer
Get
Return myiPar
End Get
Set(ByVal value As Integer)
myiPar = value
End Set
End Property
End Class
但是我没办法在页面给piPar属性输入值,提示说 变量没定义
页面文件
<%@ Register TagPrefix="uc1" TagName="Bbshot10" Src="inc/Bbshot10.ascx" %>
<uc1:Bbshot10 id="Bbshot101" runat="server"></uc1:Bbshot10>
页面源码
bbshot101.pipar=3
这里就不行了,我试了 定义bbshot101 as UserControl
但是也没pipar属性。
我应该怎么做。
问题点数:20、回复次数:3Top
1 楼jadeface(颜如玉)回复于 2006-03-01 15:37:42 得分 20
系统自带Web控件会自动增加有关定义 用户控件通常需要在代码文件中手工添加
Protected WithEvents bbshot101 As Bbshot10
Top
2 楼nill(麒麟)回复于 2006-03-02 10:59:41 得分 0
谢谢 自己补充一点
要在用户控件那加<%@ Control Language="vb" AutoEventWireup="false" Codebehind="Bbshot10.ascx.vb" Inherits="Nill.ZL.Car.Bbshot10" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" Class="BBshot10" %>
然后在页面定义的时候要用完整的路径Top
3 楼nill(麒麟)回复于 2006-03-02 11:02:09 得分 0
不能加Class="xxxx"Top




