Posts

Showing posts with the label Get Checkbox selected values in a array

code gives you SPFieldLookupValueCollection in array format

SPFieldLookupValueCollection fieldValues1 = new SPFieldLookupValueCollection (); foreach ( Control ctrl in PnlProfileTags.Controls )// Form Control Id {     CheckBox cb = ctrl as CheckBox ;     if (cb != null )     {         if (cb.Checked)         {             int TageID = Convert .ToInt32(cb.ID.Substring(4));   var TagItm = web.Lists[listTags.Title].GetItemById(TageID);  fieldValues1.Add( new SPFieldLookupValue (TagItm.ID, TagItm.Title));          }      }  } List < string > strValues = new List < string >();   foreach ( var item in fieldValues1)  {      strValues.Add(item.ToString().Split( '#' )[1]);  }   string [] ProfiletagformValue...