C# ASP.NET 中的用户控件怎样传值进去????
我想把几个符串传进用户控件里,,,再在用户控件里取出值来..该 怎样办!
问题:怎样传进去...和怎样取值 ?>???
我想把几个符串传进用户控件里,,,再在用户控件里取出值来..该 怎样办!
问题:怎样传进去...和怎样取值 ?>???
解决方案 »
- 用正则表达式获得 href 地址和<a>之间的文字和font之间的时间值
- vss与bin目录dll的问题!
- FireFox里F5刷新多次后,div背景图片丢失怎么解决?
- 请大牛帮我看看,我这样自己做一个缓存服务器前端是否合理?应该怎么样修改?
- 在建立与服务器的连接时出错。在连接到 SQL Server 2005 时......
- 如何将DataReader读取的一串数据填充到一个动态数组当中,有没有好的实现方法
- 点击图片就提示下载的代码怎么写?
- 教你实现呈现流格式图像的图像控件,还有分拿
- 这样的正则提取怎么写啊
- 网页上的滚动的新闻怎么做的
- 用asp.net 怎么做成这中效果
- gridview中放一列按纽,怎么知道获取的哪一行呢?
private int m_minValue;
private int m_maxValue = 100;
private int m_currentNumber = 0;
public int MinValue
{
get
{
return m_minValue;
}
set
{
if(value >= this.MaxValue)
{
throw new Exception("MinValue must be less than MaxValue.");
}
else
{
m_minValue = value;
}
}
}public int MaxValue
{
get
{
return m_maxValue;
}
set
{
if(value <= this.MinValue)
{
throw new
Exception("MaxValue must be greater than MinValue.");
}
else
{
m_maxValue = value;
}
}
}public int CurrentNumber
{
get
{
return m_currentNumber;
}
}protected void Page_Load(Object sender, EventArgs e)
{
if(IsPostBack)
{
m_currentNumber =
Int16.Parse(ViewState["currentNumber"].ToString());
}
else
{
m_currentNumber = this.MinValue;
}
DisplayNumber();
}protected void DisplayNumber()
{
textNumber.Text = this.CurrentNumber.ToString();
ViewState["currentNumber"] = this.CurrentNumber.ToString();
}protected void buttonUp_Click(Object sender, EventArgs e)
{
if(m_currentNumber == this.MaxValue)
{
m_currentNumber = this.MinValue;
}
else
{
m_currentNumber += 1;
}
DisplayNumber();
}protected void buttonDown_Click(Object sender, EventArgs e)
{
if(m_currentNumber == this.MinValue)
{
m_currentNumber = this.MaxValue;
}
else
{
m_currentNumber -= 1;
}
DisplayNumber();
}
</script>
<asp:TextBox ID="textNumber" runat="server"
ReadOnly="True" Width="32px" Enabled="False" />
<asp:Button Font-Bold="True" ID="buttonUp" runat="server"
Text="^" OnClick="buttonUp_Click" />
<asp:Button Font-Bold="True" ID="buttonDown" runat="server"
Text="v" OnClick="buttonDown_Click" />
public Username
{
set
{
username=this.value;
}
get
{
return username;
}
}要传值,Username="sfafd";
取值 什么什么=Username;
不知道有没有写错,呵呵,你试试吧.
调用的时候指定属性MinValue和MaxValue另:如果有问题,可以先查一下MSDN会更好,这个就是MSDN上的