1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Videobox module

Videobox module

2 posts, 0 answered
  1. Richard
    Richard avatar
    16 posts
    Registered:
    14 Apr 2009
    24 May 2009
    Link to this post
    Hi

    Just wondering has anyone implemented a module that shows videos using the VideoBox scripts? That is, in the same way that images may use a Lightbox?

    Also, if you want to have a single image thumbnail which will display full size in a lightbox, how do you usually do this? Only way I can see is to put the image in an image library all of its own.

    thanks

    Richard
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    25 May 2009
    Link to this post
    Hello Richard,

    You can create a user control and implement VideoBox. In this user control you can implement logic using Sitefinity's API which will allow you to pick libraries and library items.

    Here is a sample that all libraries are bounded to a RadComboBox control. This will allow you to select all items from a library.

    using System; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using Telerik.Libraries; 
    using System.Collections; 
    using Telerik.Web.UI; 
     
    public partial class MyControls_GalleryPicker : System.Web.UI.UserControl, ITextControl 
        #region Properties 
     
        /// <summary> 
        /// Property mandated by ITextControl interface which is used by Sitefinity to set or 
        /// get the value for the GalleryID metafield. 
        /// </summary> 
        public string Text 
        { 
            get 
            { 
                return PickerCombo.SelectedValue; 
            } 
            set 
            { 
                 
                text = value; 
            } 
        } 
        #endregion 
        #region Methods 
     
        protected void Page_Load(object sender, EventArgs e) 
        { 
            BindGalleries(); 
            SetSelectedGallery(text); 
        } 
     
        void SetSelectedGallery(string value) 
        { 
            for(int i = 0; i < PickerCombo.Items.Count; i++) 
            { 
                if (PickerCombo.Items[i].Value == value) 
                { 
                    PickerCombo.SelectedIndex = i; 
                    break
                } 
            } 
        } 
     
        void BindGalleries() 
        { 
            PickerCombo.Items.Clear(); 
     
            RadComboBoxItem defaultItem = new RadComboBoxItem("-- Select a gallery --", Guid.Empty.ToString()); 
            PickerCombo.Items.Add(defaultItem); 
     
            LibraryManager manager = new LibraryManager(); 
            // get All libraries of type Image 
            IList galleries = manager.GetAllLibraries("Image"true); 
            //get AllLibraries of type Video 
            //IList galleries = manager.GetAllLibraries("Video", true); 
            PickerCombo.AppendDataBoundItems = true
            PickerCombo.DataTextField = "Name"
            PickerCombo.DataValueField = "ID"
            PickerCombo.DataSource = galleries; 
            PickerCombo.DataBind(); 
        } 
        #endregion 
        #region Private fields 
     
        string text; 
        #endregion 
     




    Using the same way you can get all content items from all video libraries.

        // This will get a list of All video items from all video libraries 
            LibraryManager manager = new LibraryManager("Libraries"); 
            IList listofLibs = manager.GetAllLibraries("Video"true); 
            foreach (ILibrary library in listofLibs) 
            { 
                IContent cnt = library.GetItems() as IContent; 
            } 
     


    In your control you can also create a property where you pass the LibraryID

        protected Guid LibraryId 
        { 
            get 
            { 
                object obj = ViewState["LibraryID"]; 
                if (obj != null
                    return (Guid)obj; 
                return Guid.Empty; 
            } 
            set 
            { 
                ViewState["LibraryID"] = value; 
            } 
        } 

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
2 posts, 0 answered