开发者

Ajax.net update panels not working on mozilla firefox

开发者 https://www.devze.com 2022-12-18 02:08 出处:网络
Don\'t know why, but when making the postback for the control to update the ajax updatePanel it actually does the full postback of the page, it works fine on IE however with mozilla it reloads the who

Don't know why, but when making the postback for the control to update the ajax updatePanel it actually does the full postback of the page, it works fine on IE however with mozilla it reloads the whole page.

<asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:Panel ID="userLogin" Visible=false runat=server>
    <table>
        <tr>
            <td colspan="2">
                <asp:Label ID="Label27" runat="server" style="font-weight: 700" 
                    Text="Registered Users"></asp:Label>
            </td>
            <td class="style2">
                &nbsp;</td>
            <td>
                <asp:Label ID="Label30" runat="server" Text="New Users" 
                    style="font-weight: 700"></asp:Label>
            </td>
            <td class="style7">
                &nbsp;</td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="Label28" runat="server" Text="Email"></asp:Label>
            </td>
            <td>
                <asp:TextBox ID="TextBox11" runat="server" Width="160px" TabIndex="1"></asp:TextBox>
            </td>
            <td class="style2">
                &nbsp;</td>
            <td>
                <asp:Label ID="Label31" runat="server" Text="Email"></asp:Label>
            </td>
            <td class="style7">
                &nbsp;<asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <asp:TextBox ID="TextBox13" runat="server" AutoPostBack="True" 
                            ontextchanged="TextBox_TextChanged" TabIndex="3" Width="160px"></asp:TextBox>
                        <asp:Image ID="Image6" runat="server" ImageUrl="~/Classifieds/images/notOk.jpg" 
                            Visible="False" />
                        <asp:Image ID="Image5" runat="server" ImageUrl="~/Classifieds/images/ok.jpg" 
                            Visible="False" />
                    </ContentTemplate>
                </asp:UpdatePanel>

         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:Label ID="registerErrorLabel" runat="server" ForeColor="Red"></asp:Label>
                        &nbsp;<asp:UpdateProgress ID=开发者_StackOverflow社区"UpdateProgress1" runat="server">
                            <ProgressTemplate>
                                <asp:Image ID="Image4" runat="server" 
                                    ImageUrl="~/Classifieds/images/ajax-loader.gif" />
                            </ProgressTemplate>
                        </asp:UpdateProgress>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="TextBox13" EventName="TextChanged" />
                        <asp:AsyncPostBackTrigger ControlID="TextBox15" EventName="TextChanged" />
                        <asp:AsyncPostBackTrigger ControlID="CheckBox4" EventName="CheckedChanged" />
                    </Triggers>
                </asp:UpdatePanel>

The textbox autopostback is true, and it just check if the user exists or is valid and displays an message on one label inside the update panel.

Here is the code behind of the event that the textbox triggers:

protected void TextBox_TextChanged(object sender, EventArgs e)
{
    if (isEmail(TextBox13.Text))
    {
        if (DB2.alreadyRegistered(TextBox13.Text))
        {
            registerErrorLabel.Text = "This email has already been registered,<br/>If you forgot your password please <a href='../../../forgot.aspx' target=blank>click here</a> (will open on a new window)";
            registerErrorLabel.Visible = true;
            Image5.Visible = false;
            Image6.Visible = true;
            TextBox13.BorderColor = System.Drawing.Color.Red;
        }
        else
        {
            registerErrorLabel.Visible = true;
            Image5.Visible = true;
            Image6.Visible = false;
            TextBox13.BorderColor = System.Drawing.Color.Green;
        }     
    }
    else {
        registerErrorLabel.Text = "Please use a valid email";
        Image5.Visible = false;
        Image6.Visible = true;
        TextBox13.BorderColor = System.Drawing.Color.Red;
    }        
}


It is probably not really working in IE.

You need to set the EnablePartialRendering parameter on your ScriptManager.


Try setting the UpdatePanel's UpdateMode to Conditional.

I am seeing the same thing you are - a postback on Chrome and Firefox but not on IE (all latest versions). Could be that IE just plays nicely without specifying the updatemode, where you may have to be more explicit with other browsers.

0

精彩评论

暂无评论...
验证码 换一张
取 消