开发者

Cannot get onserverclick to work

开发者 https://www.devze.com 2022-12-18 12:43 出处:网络
Here\'s what is in my .aspx: <div><input id=\"testButton\" type=\"image\" src=\"<%=TestImageUrl %>\" onserverclick=\"RedirectTest\" /></div>

Here's what is in my .aspx:

<div><input id="testButton" type="image" src="<%=TestImageUrl %>" onserverclick="RedirectTest" /></div>

And in my code-behind this:

protected void RedirectTest(object sender, EventAr开发者_StackOverflow中文版gs e)
{
    // Logic is here
}

It's not hitting my method at all when I click the image. And please note, I do not want to use an ImageButton. I want to figure out how to get this working with a plain old input tag.


Seems like you're missing the runat="server" attribute on the input tag.


You need to add runat='server' to the input's definition


you need to add a runat="server" attribute to your input tag.

0

精彩评论

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