PositiveGuy
PositiveGuy

Reputation: 47743

Cannot get onserverclick to work

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, EventArgs 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.

Upvotes: 0

Views: 1322

Answers (3)

pblasucci
pblasucci

Reputation: 1778

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

Upvotes: 0

Robban
Robban

Reputation: 6802

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

Upvotes: 3

Marek Karbarz
Marek Karbarz

Reputation: 29304

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

Upvotes: 1

Related Questions