Jquery Firefox中的ASP下拉列表
我目前正在开发一个使用下拉列表动态加载数据的网页 如果我从下拉列表中选择了一个项目,并且在加载数据之后,我立即尝试选择另一个项目(就像我第一次没有点击一样),那么什么也不会发生。如果我再单击一次,效果很好 如果我选择一个项目,单击其他任何位置,然后再次尝试选择另一个项目,它也可以正常工作 这个问题不会出现在Chrome、IE或早于Firefox v33的Firefox版本中 下面是我的代码的基本功能以及它是如何实现的。请注意,我选择菜单项的前两次工作正常,只有在第三次时问题才开始出现Jquery Firefox中的ASP下拉列表,jquery,asp.net,firefox,Jquery,Asp.net,Firefox,我目前正在开发一个使用下拉列表动态加载数据的网页 如果我从下拉列表中选择了一个项目,并且在加载数据之后,我立即尝试选择另一个项目(就像我第一次没有点击一样),那么什么也不会发生。如果我再单击一次,效果很好 如果我选择一个项目,单击其他任何位置,然后再次尝试选择另一个项目,它也可以正常工作 这个问题不会出现在Chrome、IE或早于Firefox v33的Firefox版本中 下面是我的代码的基本功能以及它是如何实现的。请注意,我选择菜单项的前两次工作正常,只有在第三次时问题才开始出现 prote
protected void ddlstMonitor_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlstRole.SelectedIndex >= 0 && ddlstMonitor.SelectedValue != "-None-" && ddlstRole.SelectedValue != "-None-")
{
loadconfig(ddlstRole.SelectedValue, ddlstMonitor.SelectedValue);
}
else
{
for (int x = 1; x <= count; x++) //hides all the controls made visible by the previous selection
{
((Label)pnlConfig.FindControl("Label" + x.ToString())).Visible = false;
((TextBox)pnlConfig.FindControl("TextBox" + x.ToString())).Visible = false;
}
btnSave.Visible = true;
conf1.Visible = true;
val1.Visible = true;
lblConfig.Text = "Please select a Monitor for the configuration settings to be loaded.";
}
lbl23.Text = "0";
}
protectedvoid ddlstMonitor\u SelectedIndexChanged(对象发送方,事件参数e)
{
如果(ddlstRole.SelectedIndex>=0&&ddlsMonitor.SelectedValue!=“无-”&&ddlstRole.SelectedValue!=“无-”)
{
loadconfig(ddlstRole.SelectedValue、ddlsMonitor.SelectedValue);
}
其他的
{
对于(int x=1;x,在没有看到代码的情况下,我倾向于指出发生这种情况时我看到的一些项目(表单在一段时间内基本上不可用)。它们是否在UpdatePanel中运行,从而导致它们自己都进行数据绑定?有时是“定向的”使用visible单击的用户是一个解决方案。有时需要确保一个selectedindexchanged事件只加载一件事情,有时您可能需要让db管理员调整查询,并确保您没有加载一个下拉框,只需3秒钟的数据拉取时间
但请从UpdatePanel开始。请提供您迄今为止拥有的代码。您迄今为止尝试了什么?还发布了一些代码。如果发布一些与之相关的代码,想象就会变得很容易。我想可能是因为在再次选择某个项目之前单击任何其他内容似乎都可以修复它,因此将焦点设置为各种对象会起作用。没有。然后我尝试在选择一个项目后禁用并启用列表。它也不起作用。Firefox建议在没有插件的安全模式下运行,并从“关于:支持”菜单重新启动浏览器。这也没有起到任何作用。我试着改变加载数据的方式,但这也没有改变任何东西。看起来没有什么变化ke正在使用它。这也不会影响IE中的它吗?
using (SqlConnection sqlConnection = new SqlConnection(dataBase))
{
sqlConnection.Open();
try
{
SqlCommand sqlCommand;
SqlDataReader sqlDataReader;
//open the connection
//setup command
sqlCommand = sqlConnection.CreateCommand();
sqlCommand.Connection = sqlConnection;
sqlCommand.CommandType = System.Data.CommandType.StoredProcedure;
sqlCommand.Parameters.Clear();
sqlCommand.CommandText = query;
//Parameters are added using the drop-down menu's selected items
//execute the query
sqlDataReader = sqlCommand.ExecuteReader();
lstType = new List<string> { };
for (int x = 1; x <= count; x++) //all the relevant previously visible controls are made invisible
{
((Label)pnlConfig.FindControl("Label" + x.ToString())).Visible = false;
((TextBox)pnlConfig.FindControl("TextBox" + x.ToString())).Visible = false;
}
if (sqlDataReader.HasRows)
{
int i = 1;
count = 1;
while (sqlDataReader.Read()) //The controls are loaded with new values.
{
((TextBox)pnlConfig.FindControl("TextBox" + i.ToString())).Attributes["TextChanged"] = "TextBox1_TextChanged";
((TextBox)pnlConfig.FindControl("TextBox" + i.ToString())).TextMode = TextBoxMode.SingleLine;
((Label)pnlConfig.FindControl("Label" + i.ToString())).Text = (string)sqlDataReader["CONFIGDESC"];
((Label)pnlConfig.FindControl("Label" + i.ToString())).Visible = true;
((TextBox)pnlConfig.FindControl("TextBox" + i.ToString())).Text = (string)sqlDataReader["CUSTOMCONFIGVALUE"];
((TextBox)pnlConfig.FindControl("TextBox" + i.ToString())).Visible = true;
((Label)pnlConfig.FindControl("lbl" + i.ToString())).Text = (string)sqlDataReader["VALUEVARIABLE"];
i++;
count++;
}
lblConfig.Text = "";
btnSave.Visible = true;
((TextBox)pnlConfig.FindControl("TextBox1")).Focus();
}
sqlConnection.Close();
}
catch
{
sqlConnection.Close();
lblResut.Visible = true;
lblResut.Text = "An error has occurred; unable to load configuration.";
for (int x = 1; x <= (count + 1); x++)
{
((Label)pnlConfig.FindControl("Label" + x.ToString())).Visible = false;
((TextBox)pnlConfig.FindControl("TextBox" + x.ToString())).Visible = false;
}
}
}
<asp:DropDownList ID="ddlstMonitor" runat="server"
AppendDataBoundItems="True" AutoPostBack="True"
onselectedindexchanged="ddlstMonitor_SelectedIndexChanged" TabIndex="2">
<asp:ListItem>-None-</asp:ListItem>
</asp:DropDownList>