SOLVED: “CS1026: ) expected” compilation error

Just updating a website and wanted the Christmas hours panel to automatically hide themselves after the holiday season but got tripped up by this misleading compilation error.

PROBLEM

It should be straightforward but I made a small typo. Unfortunately the compiler wasn’t too helpful with its error report so you might be left scratching your head at this seemingly valid snippet of code:

<div class="messagebox" runat="server" visible='<%# (DateTime.Now < new DateTime(2015, 01, 03)) ? true : false; %>'>

image

SOLUTION

The ) that it claims to be expecting is not the droid its looking for.

With these inline statements you don’t need to add the semicolon ; on the end of the snippet. Removing that fixed it right up!

No comments :