I am trying to use to use ClientScriptManager.RegisterForEventValidation to register a hidden field and value that I am adding with ClientScriptManager.RegisterHiddenField. I doing this during the Render event. I get no error, but ASP.NET 2.0 does not appear to be validating the field. I can change the value or delete the entire field clientside using Firefox and Firebug, and ASP.NET will not throw an error like it should.
Sample code from a custom Page class:
protected override void Render(HtmlTextWriter writer)
{
ClientScript.RegisterHiddenField("stuff", "things");
ClientScript.RegisterForEventValidation("stuff", "things");
base.Render(writer);
}
The hidden field is added to the page, but ASP.NET does not validate the field or value on postback. What am I missing?