what kind of properties? are they very unique? if I understand you correctly, you need to write a Component Editor, try to get this bookhttp://www.microsoft.com/mspress/books/toc/5728.asp#TableOfContentsor at least, play with the sample code in chapter 15or see another example athttp://www.dotnetjohn.com/articles.aspx?articleid=187
public class WebUserControl1 : System.Web.UI.UserControl { protected System.Web.UI.WebControls.TextBox TextBox1; private int m_txtWidth; public int TxtWidth { get { return m_txtWidth; } set { m_txtWidth=value; TextBox1.Width=m_txtWidth; } //Page_load方法略. } 然后在你想要加入控件的页面中,像下面这样写,就可以把控件中的文本框设为100px宽<uc1:webusercontrol1 txtWidth=100 id="WebUserControl1" runat="server"></uc1:webusercontrol1>
能说得详细些吗?谢谢
楼主是不是想当你选定一个用户控件后
在右下角的属性页可以设定相关的属性啊如果是的话,你就在这个用户控件的类里面给它添加一些属性和字段就可以了
比如你的控件名为webusercontrol1,其中包含一个文本框,名为TextBox1,现在你想给控件添加一个可以改变控件中文本框宽度的属性,你就可以这样------------------------------------------------------------------------------
WebUserControl1的后台CS代码:
public class WebUserControl1 : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.TextBox TextBox1;
private int m_txtWidth; public int TxtWidth
{
get
{
return m_txtWidth;
}
set
{
m_txtWidth=value;
TextBox1.Width=m_txtWidth;
}
//Page_load方法略.
}
然后在你想要加入控件的页面中,像下面这样写,就可以把控件中的文本框设为100px宽<uc1:webusercontrol1 txtWidth=100 id="WebUserControl1" runat="server"></uc1:webusercontrol1>
自己已经开发好的ASP.NET控件上设置呀
我第一次看到5个星的人