简体   繁体   中英

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.

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

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 . Otherwise code is ok.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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