Ответ 1
Это должно быть все, что вам нужно, если я получу то, что вы просите:
if (c is TextBox)
{
((TextBox)c).Text = "This should be the new text";
}
Если ваша основная цель - просто установить текст:
if (c is ITextControl)
{
((ITextControl)c).Text = "This should be the new text";
}
Для поддержки скрытого поля:
string someTextToSet = "this should be the new text";
if (c is ITextControl)
{
((ITextControl)c).Text = someTextToSet;
}
else if (c is HtmlInputControl)
{
((HtmlInputControl)c).Value = someTextToSet;
}
else if (c is HiddenField)
{
((HiddenField)c).Value = someTextToSet;
}
В логику должны быть добавлены дополнительные элементы управления/интерфейсы.