I am able to get the IDs of all the controls of a page and also their type, in the page when i print it it shows
myPhoneExtTxt Type:System.Web.UI.HtmlControl
This should be all you need if I get what you're asking:
if (c is TextBox)
{
((TextBox)c).Text = "This should be the new text";
}
If your primary goal is to just set some text:
if (c is ITextControl)
{
((ITextControl)c).Text = "This should be the new text";
}
In order to support a hidden field as well:
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;
}
Additional controls/interfaces would have to be added to the logic.