protected void Page_Load (object sender, EventArgs e)
{
var list = new List<string> {
"One",
"Two",
"Three"
};
try {
GetUniqueIDRelativeTo (null);
} catch (ArgumentNullException ex) {
log.InnerText += String.Format ("Page; Relative to: null; Result: exception {0} (expected)\n", ex.GetType ());
} catch (Exception ex) {
log.InnerText += String.Format ("Page; Relative to: null; Result: exception {0}\n", ex.GetType ());
}
var ctl = new Control ();
try {
ctl.GetUniqueIDRelativeTo (this);
} catch (InvalidOperationException ex) {
log.InnerText += String.Format ("A control; Relative to: {0}; Result: exception {1} (expected)\n", this.UniqueID, ex.GetType ());
} catch (Exception ex) {
log.InnerText += String.Format ("A control; Relative to: {0}; Result: exception {1}\n", this.UniqueID, ex.GetType ());
}
try {
textBox1.GetUniqueIDRelativeTo (this);
} catch (InvalidOperationException ex) {
log.InnerText += String.Format ("TextBox; Relative to: {0}; Result: exception {1} (expected)\n", this.UniqueID, ex.GetType ());
} catch (Exception ex) {
log.InnerText += String.Format ("TextBox; Relative to: {0}; Result: exception {1}\n", this.UniqueID, ex.GetType ());
}
repeater1.DataSource = list;
repeater1.DataBind ();
}