开发者

'ImageButton' must be placed inside a form tag with runat=server

开发者 https://www.devze.com 2022-12-19 06:58 出处:网络
I\'ve got the ImageButton wrapped inside a form tag with runat=\"server\" but STILL getting this error at runtime.Th开发者_开发技巧e form tag is at the very beginning (before my table) and end tag is

I've got the ImageButton wrapped inside a form tag with runat="server" but STILL getting this error at runtime. Th开发者_开发技巧e form tag is at the very beginning (before my table) and end tag is at the end (after the table).

<td>
    <div>
    <div id="pay-Button"><asp:ImageButton ID="PayButton" ImageUrl="<%=PayButtonImageUrl %>" OnClick="RedirectTest" runat="server" /></div>
    </div>
</td>


You can't have managed controls within a <form> tag without the runat='server'. ASP.Net supports multiple form tags, but with only one of them having a server-side designation. Also, I don't believe that HTML supports nested forms. You'll either want to have it be a non-managed control in a separate form or remove the nested <form> tag from the server-side form.

Look here for further explanation.


remove the ImageUrl="<%=PayButtonImageUrl %>" part, I don't believe you can use those inline snippits for server control properties (unless you're databinding)


Does your tag also have

runat="server"

as an attribute?

It would be helpful if you showed more of your code so we can help.

0

精彩评论

暂无评论...
验证码 换一张
取 消