我们可以通过使一些控件不可见而在多个asp.net网页中使用一个用户控件吗? [英] Can we use one user control in multiple asp.net webpage by making some controls invisible?

查看:86
本文介绍了我们可以通过使一些控件不可见而在多个asp.net网页中使用一个用户控件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1)我们将如何在用户控件中指定两个网页的行为方式不同。



2)因为我有一个用户控件将用于两个webpages.But我需要让一些控件不可见。

1) How we will specify in user control behave differently for two web pages.

2) As i have one user control which is to be used in two webpages.But i need to make some controls to be invisible.

推荐答案

我们可以通过使一些控件看不见来在多个asp.net网页中使用一个用户控件

是的。



我们将如何在用户控制中指定两个网页的行为方式不同。

通过定义用户控件公共属性或使用 FindControl 方法公开控件。引用控件后,设置可见性。
can we use one user control in multiple asp.net webpage by making some controls invisible
Yes.

How we will specify in user control behave differently for two web pages.
By exposing controls via defining user control public properties or using FindControl method. Once you have reference to the control, set the visibility.


用户控件可以使用参数,以便每个页面可以传递不同的参数。根据此参数,您可以打开/关闭控件中的功能。



例如:
Your user control can take parameters so that each page can pass different parameters. Depending on this parameter, you can turn on/off features in the control.

Eg:
<user:MyControl id="myUserControl" runat="server" CustomProperty="Some Value" ></user:MyControl>


您必须代表用户控件创建参数这些参数可以隐藏/显示控件。
You must create parameters in User Control on behalf of those parameters you can hide/show controls.


这篇关于我们可以通过使一些控件不可见而在多个asp.net网页中使用一个用户控件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆