简体   繁体   English

一个页面上的多个ASP.NET用户控件

[英]Multiple ASP.NET User Controls on a page

I'm adding 3-4 instances of a custom user control that I built in my ASP.NET project. 我要添加3-4个在ASP.NET项目中构建的自定义用户控件的实例。

I have a couple of properties that I set in the aspx page at design time, but for some reason when I try to access the values in the user control, the only value that is available is the last instance of my user control that was added to the page. 我在设计时在aspx页面中设置了几个属性,但是由于某些原因,当我尝试访问用户控件中的值时,唯一可用的值是添加的用户控件的最后一个实例。到页面。

It seems like the properties are public across all instances of a user control on a page. 似乎属性在页面上的用户控件的所有实例之间都是公共的。

Is anyone else seeing? 还有其他人看到吗? Do you know of a better way to resolve this issue? 您知道解决此问题的更好方法吗?

我认为您需要实现INamingContainer接口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM