In my form, I have a button control. It has an OnClientClick() event. I just put something in there just to see if that could be seen by my code. I am using loControlButton.OnClickClient.Length to see if I have something in there. I can see that it recognizes it by showing me the exact OnClickClient() value I put in the form by using loControlButton.OnClickClient. But, before executing that line, I am adjusting the OnClick event by doing this:
loControlButton.Attributes.Add("onClick","window.location='/'; return false;')
However, this doesn't seem to be recognized. It seems whatever I do in the code is effective when the page loads but is not recognized when the code is being executed. What can I do to adjust that so my code will recognize the onClick attribute I just added?