The controls collection cannot be modified because the control contains code blocks(i.e, <%...%>)

StackOverflow https://stackoverflow.com/questions/20241475

문제

I have this problem which seems to be a common one, I have fixed the said issue but by fixing it I have made another issue and I'm hoping someone knows a way to fix it.

I have images on a webpage which need to resolve the URL before when I had the issue with code blocks it looked like

<td><img src='<%=ResolveUrl("~/")%>content/images/like_icon.png' alt="facebook" /></td>

I changed the <%= to <%# which fixed the code blocks but the image is not loading anymore.

<td><img src='<%#ResolveUrl("~/")%>content/images/like_icon.png' alt="facebook" /></td>

also I have done the same to the JavaScript on the page which has done the same type of thing, the java does nothing anymore!

any ideas on this issue would be a great help!

Thanks

Thomas James

도움이 되었습니까?

해결책

Issue Fixed added a Div with runat="server" around all the content which fixed the issue

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top