本文介绍了添加连接时可见错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我需要根据复选框列表中选择的选项使面板可见并隐藏。 如果在复选框列表中选择了一个事件,它的工作正常。 但是当点击多个事件时,它只显示一个记录,这是第一个记录。 在评论中我试图连接但当我这样做时没有什么是可见的 请帮助我... b $ b I need to make panels visible and hide based on the options selected in checkbox list.Its working fine if just one event is selected in checkbox list.but when more than event is clicked it just shows only one record which is the first in line.In the comment I have tried to put in concatenate but when I do that nothing is visibleplease help me...protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) { if (RadioButtonList1.SelectedValue == "Negotiate") { pnl_nego.Visible = true; } else { pnl_nego.Visible = false; } } protected void CheckBoxList1_SelectedIndexChanged(object sender, EventArgs e) { if (CheckBoxList1.SelectedValue == "Salary"|| CheckBoxList1.SelectedValue == "Location" || CheckBoxList1.SelectedValue == "Title") { Pnl_nego_entities.Visible = true; } else { Pnl_nego_entities.Visible = false; } if (CheckBoxList1.SelectedValue == "Salary") { pnl_salary_nego.Visible = true; } else { pnl_salary_nego.Visible = false; } if (CheckBoxList1.SelectedValue == "Title") { pnl_title_nego.Visible =true; } else { pnl_title_nego.Visible = false; } if (CheckBoxList1.SelectedValue == "Location") { pnl_location_nego.Visible = true; } else { pnl_location_nego.Visible = false; } /* if ((CheckBoxList1.SelectedValue == "Salary") && (CheckBoxList1.SelectedValue == "Title")&& (CheckBoxList1.SelectedValue == "Location")) { pnl_salary_nego.Visible = true; pnl_title_nego.Visible = true; pnl_location_nego.Visible = true; } else { pnl_salary_nego.Visible = false; pnl_title_nego.Visible = false; pnl_location_nego.Visible = false; } if ((CheckBoxList1.SelectedValue == "Salary")&& (CheckBoxList1.SelectedValue == "Location")) { pnl_salary_nego.Visible = true; pnl_location_nego.Visible = true; } else { pnl_salary_nego.Visible = false; pnl_location_nego.Visible = false; } if ((CheckBoxList1.SelectedValue == "Salary") && (CheckBoxList1.SelectedValue == "Title")) { pnl_salary_nego.Visible = true; pnl_title_nego.Visible = true; } else { pnl_salary_nego.Visible = false; pnl_title_nego.Visible = false; pnl_title_nego.Visible = false; } if ((CheckBoxList1.SelectedValue == "Location") && (CheckBoxList1.SelectedValue == "Title")) { pnl_salary_nego.Visible = true; pnl_location_nego.Visible = true; } else { pnl_salary_nego.Visible = false; pnl_location_nego.Visible = false; pnl_title_nego.Visible = false; } */ 推荐答案 问题很简单,真的:看看在您注释掉的代码中。第一个如果相当于: The problem is quite simple, really: have a look at your commented out code. The first if is the equivalent of:if (A == 1 && A == 2 && A ==3) { ... }在任何情况下都永远不会 true - 这样做会要求变量同时具有三个不同的值!It will never, ever, under any circumstances be true - to do so would require a variable to have three different values simultaneously! 这篇关于添加连接时可见错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-30 05:54