public void Refresh() { Controls.Clear(); if (Page != null) { int i = 0; string noImageUrl = ClientScriptProxy.Current.GetWebResourceUrl(this, GetType(), "Thumbnail.Web.Resources.noimage.jpg"); foreach (IThumbNailItem item in dataSource) { Table table = CreateTable(); var img = new System.Web.UI.WebControls.Image { ID = ID + "_" + (i++) }; var requestTextPictureItemEventArgs = new RequestTextThumbnailItemEventArgs(item); OnRequestText(requestTextPictureItemEventArgs); SetImageProperties(item, img, noImageUrl,requestTextPictureItemEventArgs.Text); CreateImageRow(img, table); CreateTextRow(item, requestTextPictureItemEventArgs, table); } } }
void CreateTextRow(IThumbNailItem item, RequestTextThumbnailItemEventArgs requestTextThumbnailItemEventArgs, Table table) { TableCell cell = CreateTextCell(item, requestTextThumbnailItemEventArgs); table.Rows.Add(new TableRow()); table.Rows[1].Cells.Add(cell); }
TableCell CreateTextCell(IThumbNailItem item, RequestTextThumbnailItemEventArgs requestTextThumbnailItemEventArgs) { var cell = new TableCell(); cell.Style["font-size"] = "80%"; cell.Style["text-align"] = "center"; cell.Style["word-wrap"] = "break-word"; cell.Style["word-break"] = "break-word"; string text1 = string.Format("<a href='{0}&{3}={1}'>{2}</a>", HttpContext.Current.Request.Url.AbsoluteUri, item.ID, requestTextThumbnailItemEventArgs.Text, ThumbnailListEditor.SelectedId); var text = new Literal { Text = text1 }; cell.Controls.Add(text); return cell; }
public void OnRequestText(RequestTextThumbnailItemEventArgs e) { EventHandler<RequestTextThumbnailItemEventArgs> handler = RequestText; if (handler != null) handler(this, e); }
void ControlOnRequestText(object sender, RequestTextThumbnailItemEventArgs requestTextThumbnailItemEventArgs) { requestTextThumbnailItemEventArgs.Text = GetDisplayText(requestTextThumbnailItemEventArgs.ItemClicked); }