I have a user control and it has a method which is executed when button on aspx page is clicked, I m passing two ids of the user control in the method, Now i want to get the values of the textbox in the user control but unfortunately it is not recognizing textbox I have coded :-
//Method to copy values from one control into another
public void copyInfo(Control ctrl1, Control ctrl2) {
List<string> vals = new List<string>();
foreach (Control c in ctrl1.Controls)
{
if (c is TextBox)
{
if (string.IsNullOrEmpty(((TextBox)c).Text)) { }
else {
//values from textbox
vals.Add(((TextBox)c).Text);
}
}
.............
..........
......
how can i get the textbox control and there values.