简体   繁体   English

基于下拉框中的值的复选框验证

[英]check box validation based on value in drop box

I am trying to add additional options by automatically checking the check box based on the value selected in the dropbox for each entry.我正在尝试通过根据每个条目在保管箱中选择的值自动选中复选框来添加其他选项。 When i give a if condition in the page_load it is not working but if i directly pass the value as false , the check box is unchecked.当我在 page_load 中给出 if 条件时,它不起作用,但如果我直接将值传递为 false ,则复选框未选中。

Previously for all the values in the particular dropdown the check box will be ticked , but now i want the checkbox to be left checked for a particular single value.ddlBrand is the ID of the dropbox以前对于特定下拉列表中的所有值,复选框都将被勾选,但现在我希望复选框被选中以获取特定的单个值。ddlBrand 是下拉框的 ID

if (ddlBrand.SelectedValue == "xyz")
 {
  chkGHS.Checked = false;
 }//not working


 chkGHS.Checked = false;// working 

When a particular value is selected (It will be automatically brought up when the entry number is given), the check box should be unticked for rest of the values it should be ticked by default选择特定值时(当给出条目号时,它将自动提升),应将复选框未被默认勾选的值勾选

You should debug it, may be your dropdown selected value is not match with xyz .您应该调试它,可能是您下拉选择的值与xyz不匹配。 Otherwise code is ok.否则代码没问题。

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

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