tags:

views:

47

answers:

1

I'm trying to set some javascript data (json) in my markup by calling a method in my codebehind file. The markup looks like this:

Line 12: var businessTypes = "<%=GetBusinessTypes(); %>";

The method is executed and it returns string value but then this exceptions pops out

CS1026: ) expected

redlining the Line 12 shown above.

+3  A: 

I believe it's because you're including a semicolon after the method call. The output tags "<%= %>" essentially wrap your code with Response.Write(...);

Try:

var businessTypes = "<%= GetBusinessTypes() %>";
Matthew Brindley
Yup, semicolon was the problem. Thanks
Vnuk