asp.net - Error with Embedded code blocks using Javascript in .net -


i error unterminated string constant when give

 <input type="button" name="cancel" value="close" onclick="javascript:top.location.href = '../admin/page.aspx?curtab=<%=curtab%>';"> 

and unterminated string constant , syntax error @ '&' following line of code

<input type="button" name="cancel" value="close" onclick="javascript:top.location.href = 'plan.aspx?res=<%=request("res")%>&count=<%=request("count")%>';"> 

can please tell me whys happens?i suppose because of embedded code block. please me

thanks in advance !

i don't think scenario can handled inline. try prepare text rendered inside onclick='[]' beforehand. first statement, example:

    <%     var bb = string.format("javascript:top.location.href = \"../admin/page.aspx?curtab={0}\";", curtab); %> <input type="button" name="cancel" value="close" onclick='<%=bb%>'> 

similarly, can see standard c# syntax escape & second statement.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -