p1 = planetlist.SelectedValue.ToString();
foreach (Control page_control in Page.Controls)
{
foreach (Control c in page_control .Controls)
{
if (c is TextBox)
{
if (c == (TextBox)Page.FindControl("txt1"))
{
((TextBox)c).Text = p1.ToString();
}
else if (c == (TextBox)Page.FindControl("TextBox1"))
{
((TextBox)c).Text = p1.ToString();
}
else if (c == (TextBox)Page.FindControl("TextBox2"))
{
((TextBox)c).Text = p1.ToString();
}
}
}
}
i wrote this thanks
but i got output in three textboxes at the same time.But i need a output in single box like this ,if control is equal to textbox1 then output is in textbox1 or if its textbox2 .then output is in textbox2.
can anyone help me to solve this problem.