C# Ajax.net更新面板在mozilla firefox上不起作用
不知道为什么,但在为控件回发以更新ajax updatePanel时,它实际上会对页面进行完整的回发,在IE上可以正常工作,但在mozilla上,它会重新加载整个页面C# Ajax.net更新面板在mozilla firefox上不起作用,c#,ajax,asp.net-ajax,ajax.net,C#,Ajax,Asp.net Ajax,Ajax.net,不知道为什么,但在为控件回发以更新ajax updatePanel时,它实际上会对页面进行完整的回发,在IE上可以正常工作,但在mozilla上,它会重新加载整个页面 <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:Panel ID="userLogin" Visible=false runat=server> <ta
<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">
</td>
<td>
<asp:Label ID="Label30" runat="server" Text="New Users"
style="font-weight: 700"></asp:Label>
</td>
<td class="style7">
</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">
</td>
<td>
<asp:Label ID="Label31" runat="server" Text="Email"></asp:Label>
</td>
<td class="style7">
<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>
<asp:UpdateProgress ID="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>
(将在新窗口中打开)”;
registerErrorLabel.Visible=true;
图5.可见=假;
图像6.可见=真实;
TextBox13.BorderColor=System.Drawing.Color.Red;
}
其他的
{
registerErrorLabel.Visible=true;
图像5.可见=真实;
图像6.可见=假;
TextBox13.BorderColor=System.Drawing.Color.Green;
}
}
否则{
registerErrorLabel.Text=“请使用有效的电子邮件”;
图5.可见=假;
图像6.可见=真实;
TextBox13.BorderColor=System.Drawing.Color.Red;
}
}
它可能在IE中不起作用
您需要在ScriptManager上设置EnablePartialRendering参数。尝试将UpdatePanel的UpdateMode设置为Conditional
我看到的和你一样——在Chrome和Firefox上发回,但在IE上没有(所有最新版本)。可能是IE在没有指定updatemode的情况下运行得很好,在其他浏览器中可能需要更加明确。嗯,您的更新面板中没有标签?您是否显示这些图像中的一个,以显示其是否有效?这也是一个建议,但您确实应该具有有意义的控件ID,因为这可能会使代码隐藏变得混乱,并通过使用错误的控件导致一些奇怪的行为。这可能是现在发生的情况,但如果不看到代码隐藏,很难判断。很抱歉,有两列,一列用于注册用户,另一列用于新用户(表上有两列)忘了包括第二个更新面板,一个在顶部,文本框旁边有一个图像,另一个在底部,registerErrorLabel(显示错误的标签,如果有)你使用的是哪个版本的C#ASP.NET?你最近升级到这个版本了吗?这里的live example设置为true,这是默认值,但在代码中也会尝试将其设置为true…希望如此。。。
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;
}
}