简体   繁体   English

单击按钮导致无法在IE浏览器asp.net中回发

[英]Button click causes not post back in IE browser asp.net

Its very strange behavior that I'm facing. 我面临的非常奇怪的行为。 I have delete button, OnClick I'm attaching it to that particular event. 我有删除按钮,OnClick我将它附加到该特定事件。 I'm storing my entire data in Session so, in if(!IsPostBack) i am clearing out the session when the page Initially loads. 我将所有数据存储在Session中,因此在if(!IsPostBack)中,我将在页面初始加载时清除会话。 When i click on the delete button instead of doing IsPostBack = true it does IsPostBack = false in IE and resets the Session data. 当我单击删除按钮而不是执行IsPostBack = true时,它将在IE中执行IsPostBack = false并重置会话数据。 But, with other browser i do get the expected functionality. 但是,使用其他浏览器,我确实可以获得预期的功能。 Does any one have any clue about this issue ? 是否有人对此问题有任何线索?

Button tag aspx file, 按钮标记aspx文件,

<tr id="rowPurpose">
<td>
    <asp:Label ID="lblPurpose1" Font-Bold="true" runat="server">Purpose</asp:Label>
</td>
<td width="65">
    <asp:Button ID="btnDeletePurpose1"   Text="Delete" Visible="false" CommandArgument="lblPurpose1" OnClick="Delete_Purpose" runat="server" />
</td>
</tr>

C# file: C#文件:

void page_load()
{
    rowPurpose.Attributes["onclick"] = "javascript:Method('id')";
    if (!Page.IsPostBack)
    {
        Session["Key"] = null;
    }
}

Thanks in advance! 提前致谢!

Are you using an HTML submit button or an <asp:Button> . 您使用的是HTML提交按钮还是<asp:Button> If you are not using the asp:Button then it will not perform a post back since the asp version wires up the PostBack functionality. 如果您不使用asp:Button则它将不会执行回发,因为asp版本会连接PostBack功能。 Also make sure you have the runat="server" attribute on the button and form. 还要确保您在按钮和表单上具有runat="server"属性。

Can you post your button and form tag in your ASPX page? 您可以在ASPX页面上发布按钮和表单标签吗?

I got this resolved. 我解决了。 From my understanding it was happening because of the two events that are firing at the same time one for the Row and other for the Button click. 据我了解,这是由于两个事件同时触发而引起的,其中一个事件针对行,另一事件针对按钮单击。 So i just made cell as clickable instead of whole row and this works fine. 因此,我只是将单元格设置为可点击的,而不是整个行都可以,这很好。

Thanks 谢谢

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

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