lundi 31 août 2020

How to show ticked checkboxes

I am creating dynamic checkboxes and then saving the ids of those in database which are checked. It being saved in the database however it does not show those checkboxes as ticked.

This is my table:

  <table>
                      <tr>
                              <td style="width: 5%;" >
                              </td>
                              <td class="description" align="centre" id="tdEAlist">
                              </td>
                      </tr>
                 </table>

Then in aspx I get this checkbox using

$('#tdEAlist').html(AJAX.getExtraData('EAlist'));

At class level:

 ArrayList ExtdataExisting = new ArrayList();
 ExtdataExisting.Add("EAlist");
 ExtdataExisting.Add(createCheckBox(getDataTableFromQuery("select id,value,null as checked 
 from ChecklistOptionSetup where type in('1');"), "chkEAlist_", ""));
 retAry.Add(ExtdataExisting);

and then finally in grid I show my checkboxes like this

 Html.Append("<td style=\"padding-left:8%\" id= 'tdEAlist' width='20%' class=\"GreyBorder\" ></td>");

for saving:

 for (int j = 0; j < AllCheckedIDs.Length; j++)
                            {
                                qry += "insert into AMLOptions(AmlAction,value,TransactionCode) 
 values(" + checkNull(AllCheckedIDs[j]) + ",'Y'," + checkNull(TransactionCode) + ");";                                       
                            }

How do I show ticked checkboxes against those who ids are saved in the database? For example I checked Low and high so their ids 1 and 3 are saved in database against column value which is showing 'Y'. I know I ma missing something really small. Kindly help.




Aucun commentaire:

Enregistrer un commentaire