In my ASP.NET page's code behind I'm creating a checkbox on the fly:
CheckBox cb = new CheckBox();
But I want the new checkbox to call a client function instead of posting back. I would expect to be able to do something like this:
cb.OnClientClick = "Javascript:MyClientFunction();";
But that doesn't exist. How do I wire it up on the fly like that?
This will work:
cb.Attributes.Add("onclick", "Javascript:MyClientFunction();");