简体   繁体   English

<asp:button>在IE9中无法正常工作

[英]<asp:button> is not working in IE9

I have a asp button in my application, which is working fine in mozilla, chrome, and IE 8 but it is not working in IE 9, I tried a lot but not getting any solution. 我的应用程序中有一个asp按钮,在mozilla,chrome和IE 8中都可以正常工作,但在IE 9中却无法正常工作,我尝试了很多,但没有得到任何解决方案。

Someone please help me in this 有人请帮我

<asp:Button CssClass="Button" ID="btnInsert" runat="server" Text="Insert" OnClick="btnInsert_Click" />

When I am checking my button with developer tools (F12) my button is showing like this 当我使用开发人员工具(F12)检查按钮时,我的按钮显示如下

<input name="btnInsert" class="Button" id="btnInsert" type="submit" value="Insert"/>

My button Click code 我的按钮点击代码

When I am trying to debug it after Button Click then pointer is going to this click but page is not submitting, but that it working fine in other browser.. 当我尝试在“按钮单击”之后调试它时,指针将指向此单击,但页面未提交,但在其他浏览器中工作正常。

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 which i am calling on button click 我点击按钮时调用的JavaScript

<script language="javascript" type="text/javascript">   
    function Insert(Id)
    {
        if (window.opener.InsertText != null)
        {
            window.opener.InsertText(Id)
            window.close();
        }
    }
</script>

Make sure you don't have any other dom element anywhere on your page that uses the id btnInsert . 确保您的页面上没有其他任何使用id btnInsert dom元素。 More often than not problems like this are caused my duplicate IDs. 像这样的问题多半是由我重复的ID引起的。

Trying changing the ID of this buttons to something crazy, like ZZZZXXXXAAA and see if your page starts working 尝试将此按钮的ID更改为类似ZZZZXXXXAAA疯狂名称,然后查看您的页面是否开始工作


As @Grrbrr404 mentions, also inspect your page for malformed html before your button. 正如@ Grrbrr404所提到的,还要按钮之前检查页面中是否有格式错误的html。

I had the same issue. 我遇到过同样的问题。 For me, the problem was that there was two form tags inside the page. 对我来说,问题是页面内有两个表单标签。 One with runat=server and another one inside that tag without runat=server. 一个带有runat = server,另一个带有不带runat = server的标记。

finally I got the answer, 终于我得到了答案,

there were some javascript problem on some other page which I was calling at the time of opening InsertText page. 在打开InsertText页面时,我正在调用其他页面上的一些javascript问题。

thanks a lot for all of you for your comments and answers. 非常感谢大家的意见和答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM