Reputation: 5022
The following C#:
SelectLink.Attributes.Add("onclick", String.Format("javascript:{0});", this.ClientScript.GetPostBackEventReference(this, "ad")));
(some omitted for clarity)
Appears to generate an href which has dropped the ';'. This causes validation errors in Internet Explorer, where it claims there is a missing ';'. I presume this is in the href. Why does it do this and how can I solve it?
<a href="javascript:__doPostBack('ctl00$MainContent$CR002,DNTL,T1.1','')" id="ctl00_MainContent_CR002,DNTL,T1.1" onclick="javascript:__doPostBack('__Page','ad'));">Click me</a>
Upvotes: 0
Views: 105
Reputation: 3470
You wrote "javascript:{0});" - just remove the closing parenthesis:
SelectLink.Attributes.Add("onclick", String.Format("javascript:{0};", this.ClientScript.GetPostBackEventReference(this, "ad")));
Upvotes: 2