I am currently reading Clean Code by Robert C. Martin. According to his book, you should refactor your method into several smaller methods, doing exactly one thing. You should for example extract every do this into its own method.
As to your question, I don't think there is any way of achieving the same logic using for loops, unless you do the same for every call.
foreach (ctl in page.ctls)
{
TextBox tempTextBox = ctl as TextBox;
if (tempTextBox != null)
{
doTheSameForEveryTextBox(tempTextBox)
}
DropDownList tempDropDownList as DropDownList; // not sure if this is the right Type...
if (tempDropDownList != null)
{
doTheSameForEveryTextBox(tempDropDownList)
}
}
void doTheSameForEveryTextBox(TextBox tempTextBox)
{
if (tempTextBox.Text == "")
{
//TODO: implement your code here
}
}
void doTheSameForEveryDropDownList(DropDownList tempDropDownList)
{
if (tempDropDownList.SelectedIndex == 0)
{
//TODO: implement your code here
}
}