Why an input button created dynamically through a literal tag doesn't work ?

Posted by user284523 on Stack Overflow See other posts from Stack Overflow or by user284523
Published on 2010-03-21T14:31:08Z Indexed on 2010/03/21 14:41 UTC
Read the original article Hit count: 308

Filed under:

I have created button 2 below:

<input id="Button1" type="button" value="Stop" 

    onclick="alert('hello world');"/> 

<input id="Button2" type="button" value="button" OnClik="alert('hello world');"/> 

using a litteral tag on page load like this:

protected void Page_Load(object sender, EventArgs e)
{

    Literal1.Text = "<input id=\"Button2\" type=\"button\" value=\"button\" OnClik=\"alert('hello world');\"/>";

}

Incredibly when testing in browser, click on button 1 works, not click on button 2 whereas the codes are the same !

Am I missing something ?

© Stack Overflow or respective owner

Related posts about ASP.NET