private void ToggleSelectedAssets() { foreach (RepeaterItem ri in OrderItemsRepeater.Items) { switch (ri.ItemType) { case (ListItemType.Item): case (ListItemType.AlternatingItem): HiddenField OrderItemIdHiddenField = (HiddenField)ri.FindControl("OrderItemIdHiddenField"); CheckBox SelectAssetCheckBox = (CheckBox)ri.FindControl("SelectAssetCheckBox"); SelectAssetCheckBox.Checked = AllAssetsSelected; int orderItemId = Convert.ToInt32(OrderItemIdHiddenField.Value); if (SelectAssetCheckBox.Checked) { SelectedOrderItems.AddUpdate(orderItemId); } else { SelectedOrderItems.Remove(orderItemId); } break; } } }
protected void SelectAssetCheckBox_CheckChanged(object sender, EventArgs e) { AllAssetsSelected = false; CheckBox cb = (CheckBox)sender; foreach (RepeaterItem ri in OrderItemsRepeater.Items) { switch (ri.ItemType) { case (ListItemType.Item): case (ListItemType.AlternatingItem): Control control = ri.FindControl(cb.ID); if (control != null && control.UniqueID == cb.UniqueID) { HiddenField OrderItemIdHiddenField = (HiddenField)ri.FindControl("OrderItemIdHiddenField"); DownloadFormatDropDownList DownloadFormatDropDownList1 = (DownloadFormatDropDownList)ri.FindControl("DownloadFormatDropDownList1"); AssetImageSizeDropDownList AssetImageSizeDropDownList1 = (AssetImageSizeDropDownList)ri.FindControl("AssetImageSizeDropDownList1"); int orderItemId = Convert.ToInt32(OrderItemIdHiddenField.Value); int assetImageSizeId = AssetImageSizeDropDownList1.SelectedId; DownloadFormat downloadFormat = DownloadFormatDropDownList1.SelectedDownloadFormat; if (cb.Checked) { SelectedOrderItems.AddUpdate(orderItemId, downloadFormat, assetImageSizeId); } else { SelectedOrderItems.Remove(orderItemId); } } break; } } }