I am facing an issue with my asp button in my application. It works perfectly fine in Mozilla, Chrome, and IE 8 but it fails to work in IE 9. I have tried various solutions but none of them seem to solve the problem.
If anyone knows how to fix this, please help me out.
<asp:Button CssClass="Button" ID="btnInsert" runat="server" Text="Insert" OnClick="btnInsert_Click" />
Upon checking my button using developer tools (F12), it appears like this:
<input name="btnInsert" class="Button" id="btnInsert" type="submit" value="Insert"/>
Here is my button click code:
Although the pointer goes to the click event during debugging, the page does not submit. This issue seems to be isolated to IE 9.
protected void btnInsert_Click(object sender, EventArgs e)
{
if (Id > 0)
{
this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), string.Format("Page1{0}", this.UniqueID), string.Format("<script language='javascript' type='text/javascript'>Insert('{0}');</script>", Id));
}
else
{
lErrorMessage.Visible = true;
}
}
Below is the JavaScript function called on button click:
<script language="javascript" type="text/javascript">
function Insert(Id)
{
if (window.opener.InsertText != null)
{
window.opener.InsertText(Id)
window.close();
}
}
</script>