private void AssetSelectionChanged() { bool isSingleSelect = SessionAssetsListBox.GetSelectedIndices().Length == 1; if (isSingleSelect) { UpdateAssetControls(); MultipleSelectionLabel.Visible = false; PreviewPanel.Visible = true; } else { MultipleSelectionLabel.Visible = true; PreviewPanel.Visible = false; } }
private void BindAssetList() { // Get assets AssetFinder finder = new AssetFinder(); finder.AssetIdList.Add(0); finder.AssetIdList.AddRange(UploadedAssetIdList); finder.AssetTypeId = AssetTypeDropDownList1.SelectedId; List <Asset> assetList = Asset.FindMany(finder); //Ensure that the items that have been added via the "template catalogue" are first in the list. List <Asset> tempAssetList = new List <Asset>(); foreach (int Id in SessionInfo.Current.User.GetCatalogueAssetIdList()) { var asset = assetList.Where(a => a.AssetId == Id).SingleOrDefault(); if (asset != null) { assetList.Remove(asset); tempAssetList.Add(asset); } } // Parse into a new list var list = from a in tempAssetList select new { a.AssetId, Text = a.AssetId + " (" + a.Filename + ")" }; // Bind the listbox SessionAssetsListBox.DataSource = list; SessionAssetsListBox.DataTextField = "Text"; SessionAssetsListBox.DataValueField = "AssetId"; SessionAssetsListBox.DataBind(); SelectFirstAsset(); }