Thursday, 2 March 2017

How to set multiple Checked in CheckBoxList in asp.net



///   C#

    public void Set_CheckBoxList_Values(CheckBoxList cbl, string[] values)
    {
        foreach (ListItem item in cbl.Items)
        {
            item.Selected = values.Contains(item.Value);
        }
     }

/// Call 

string[] Partner = Convert.ToString(dtvp_A.Rows[0]["PartnerName"]).Split(',');
SetCheckBoxListValues(CBL_aNamePartner, Partner);

   

/// Result


No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...