Just wondering if it was possible to not split the following steps…
Button b = new Button()
{
// You can access Attributes here, but only get, not set.
ID = "btnExample",
Text = "Click Me"
};
b.Attributes.Add("onclick", "alert('hello, world')");
Thanks in advance.
You could drive from Button and add it to the constructor: