I have a TextBox inside a UserControl , and this UserControl repeated inside the Repeater . But when the user fills the TextBox values โโand after that I can not get the values โโfrom TextBox s.
default.aspx:
protected void Page_Load(object sender, EventArgs e) {
In button1 click, I'm trying to populate the List<string> values โโfrom textbox.text s
protected void Button1_Click(object sender, EventArgs e) { List<string> sss = new List<string>(); foreach (Control i in Repeater1.Controls) { foreach (Control item in i.Controls) { if (item is WebUserControl1) sss.Add(((WebUserControl1)item).getString); } } }
And UserControl code:
public string getString { get { return TextBox1.Text; } } protected void Page_Load(object sender, EventArgs e) { }
source share