I have created a Website Project in VS2010. My Controls are not rendered correctly. The JS that is produced is not correctly formatted. Here is an example:
protected void Page_PreRender(object sender, EventArgs e)
{
if (!IsPostBack)
{
objListBox.Attributes.Add("onchange", "Control_doPostBack('" + objListBox.ClientID + "','ListBox_OnClick'); return false;");
objListBox.Attributes.Add("onblur", "Control_doPostBack('" + trListbox.ClientID + "','ListBox_OnBlur'); return false;");
img.Attributes.Add("onclick", "Control_doPostBack('" + trListbox.ClientID + "','IMG_OnClick'); return false;");
}
}
and the responding control is rendered as:
<select size="4" name="ctl00$PlaceHolder_Content$drop$objListBox" onchange="Control_doPostBack('PlaceHolder_Content_drop_objListBox','ListBox_OnClick'); return false;setTimeout('__doPostBack(\'ctl00$PlaceHolder_Content$drop$objListBox\',\'\')', 0)" id="PlaceHolder_Content_drop_objListBox" onblur="Control_doPostBack('PlaceHolder_Content_drop_trListbox','ListBox_OnBlur'); return false;" style="position:absolute;">
</select>
As you can see, the ' are rendered to '
which screwes up the Browser.
Is there a tweak to msbuild or inside the project properties?
Any help is highly appreciated.