Here it goes how...
UserControl.
1 public partial class WebUserControl : System.Web.UI.UserControl
2 {
3 public string TextBoxValue {
4 get { return TextBox1.Text; }
5 set { TextBox1.Text = value; }
6 }
7 protected void Page_Load(object sender, EventArgs e) {
8
9 }
10 }
In your .aspx page you can access it either html or code
<%@ Register TagPrefix="DS" TagName="TB" Src="~/WebUserControl.ascx" %>
or
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
myTB1.TextBoxValue = "Sample Text";
}
}
0 comments:
Post a Comment