The above posted code is working for me.. and i am not sure why you are getting this error..
below is the tested code which is also working for me..
<asp:Button ID="Button2" runat="server" Text="Button" BorderWidth="1px" />
Page_Load event
Button2.Attributes.Add("onmouseover", "this.style.borderStyle ='none';")
Button2.Attributes.Add("onmouseout", "this.style.borderStyle ='solid';")
Check out this link. may be helpful to you..
http://www.velocityreviews.com/forums/t118385-how-to-do-onmouseoveronmouseout-events-on-aspnet-button.html