Royal,
Enabling the search of controls ain't too bad:
main page:
if (!IsPostBack)
{
DoControls(this);
sub-routine:
// recursive routine for finding all controls underneath a parent (page)
private void DoControls(Control c)
{
if (c.HasControls())
{
foreach (Control o in c.Controls)
{
DoControls(o);
}
}
else
System.Diagnostics.Debug.WriteLine(c.GetType().ToString());
}
output:
System.Web.UI.LiteralControl
System.Web.UI.HtmlControls.HtmlTitle
System.Web.UI.LiteralControl
System.Web.UI.LiteralControl
System.Web.UI.WebControls.GridView
System.Web.UI.LiteralControl
System.Web.UI.LiteralControl
However, in order to gain the values etc from the controls, you'll have to "assess" their type (typeof), and unless you absolutely know that the control you want the values from has the same attribute that is accessible (ie ".Text" for instance) - you'll still have to do the appropriate cast I think.
The class could contain a simple hashtable / dictionary - where you could store the control name against its value.
Dunno if this is the kind of thing you're thinking of, but don't see why it shouldn't work.
Joe
Enter your message below
Sign in or Join us (it's free).