I have a strange behaviour as follows:
public class SaveWebControlObject
{
public WebControl control;
}
public partial class Default : System.Web.UI.Page
{
SaveWebControlObject swco = new SaveWebControlObject();
protected void ButtonClick1(...) // click a button
{
Label1.Text = "button clicked";
sco.control = Label1;
}
protected void ButtonClick2(...) // undo a button click
{
((Label)sco.control).Text = "undone";
}
}
I debugged ButtonClick2() method and it confirmed that the label object
saved in SaveWebControlObject.control was assigned the text "undone"
but it fails to show up on the page.
What am I missing here?
Rich