我的应用程序中有一个 asp 按钮,它在 mozilla、chrome 和 IE 8 中工作正常,但在 IE 9 中不起作用,我尝试了很多但没有得到任何解决方案。
谁能帮帮我
<asp:Button CssClass="Button" ID="btnInsert" runat="server" Text="Insert" OnClick="btnInsert_Click" />
当我使用开发人员工具 (F12) 检查我的按钮时,我的按钮显示如下
<input name="btnInsert" class="Button" id="btnInsert" type="submit" value="Insert"/>
我的按钮点击代码
当我尝试在单击按钮后对其进行调试时,指针将指向此单击,但页面未提交,但它在其他浏览器中工作正常..
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;
}
}
我在点击按钮时调用的 JavaScript
<script language="javascript" type="text/javascript">
function Insert(Id)
{
if (window.opener.InsertText != null)
{
window.opener.InsertText(Id)
window.close();
}
}
</script>
最佳答案
确保您的页面上没有任何其他使用 id btnInsert
的 dom 元素。像这样的问题通常是由于我的 ID 重复造成的。
尝试将此按钮的 ID 更改为一些疯狂的东西,例如 ZZZZXXXXAAA
并查看您的页面是否开始工作
正如@Grrbrr404 提到的那样,在您的按钮之前,还要检查您的页面是否存在格式错误的 html。
关于c# - <asp :button> is not working in IE9,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8846399/