private Message saveCaptions() { // Iterate through all the textboxes, saving any captions that have changed. // The media object IDs are stored in a hidden input tag. HtmlInputText ta; HtmlTextArea tdesc; HtmlInputHidden gc; IGalleryObject mo; string newTitle, previousTitle, previousTags, previousDescription; Message msg = Message.None; if (!IsUserAuthorized(SecurityActions.EditMediaObject)) { return(msg); } try { HelperFunctions.BeginTransaction(); // Loop through each item in the repeater control. If an item is checked, extract the ID. foreach (RepeaterItem rptrItem in rptr.Items) { ta = (HtmlInputText)rptrItem.Controls[1]; // The <input TEXT> tag tdesc = (HtmlTextArea)rptrItem.Controls[3]; // The <TEXTAREA> tag gc = (HtmlInputHidden)rptrItem.Controls[5]; // The hidden <input> tag // Retrieve new title. Since the Value property of <TEXTAREA> HTML ENCODEs the text, // and we want to store the actual text, we must decode to get back to the original. newTitle = Util.HtmlDecode(ta.Value); mo = Factory.LoadMediaObjectInstance(Convert.ToInt32(gc.Value, CultureInfo.InvariantCulture), true); previousTitle = mo.Title; mo.Title = Util.RemoveHtmlTags(newTitle); if (mo.Title != previousTitle) { GalleryObjectController.SaveGalleryObject(mo); } SueetieMediaObject _sueetieMediaObject = SueetieMedia.GetSueetieMediaObject(CurrentSueetieGalleryID, mo.Id); previousDescription = _sueetieMediaObject.MediaObjectDescription; _sueetieMediaObject.MediaObjectDescription = tdesc.Value; if (_sueetieMediaObject.MediaObjectTitle != newTitle || _sueetieMediaObject.MediaObjectDescription != previousDescription) { SueetieMedia.UpdateSueetieMediaObject(_sueetieMediaObject); } } HelperFunctions.CommitTransaction(); } catch { HelperFunctions.RollbackTransaction(); throw; } HelperFunctions.PurgeCache(); SueetieMedia.ClearSueetieMediaObjectListCache(CurrentSueetieGalleryID); return(msg); }