attaching several video links

Farah El Agha asked on November 27, 2017 11:51

referring the case: https://devnet.kentico.com/questions/links-between-page-types I tried attaching Images and it worked fine and I could upload and display as many Images as I wanted, but I am facing a problem with videos, which I want to add as

Correct Answer

Vukasin Andjelic answered on November 28, 2017 12:41

User control ASCX:

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ShowImageControl.ascx.cs" Inherits="CMSApp.ShowImage.Control.ShowImage" %>

<asp:Panel runat="server" ID="AddToDivImages">

</asp:Panel>

CodeBehind:

using System;

namespace CMSApp.ShowImage.Control
{
    public partial class ShowImage : System.Web.UI.UserControl
    {
        public string ImageFieldValues { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            string[] values = ImageFieldValues.Split('|');

            //TODO: here is your foreach loop, with which u will add dynamically images to the asp:panel
        }
    }
}

ASCX transformation:

<%@ Register Src="~/ShowImage/Control/ShowImageControl.ascx" TagPrefix="si" TagName="ShowImage" %>

<si:ShowImage runat="server" id="ShowImageID" ImageFieldValues=<%# Eval("FieldName") %> />
0 votesVote for this answer Unmark Correct answer

Recent Answers


Peter Mogilnitski answered on November 27, 2017 15:22

The best way would be to create a media library for videos. Upload your files there and then use media gallery web part to display them. If you take a look at corporate site you will be able to find the example under /Media/Videos

0 votesVote for this answer Mark as a Correct answer

Farah El Agha answered on November 27, 2017 15:31

I am sorry but it seems that the question was trimmed by mistake, the rest of the question was describing that I dont want to upload the video to the site, I wanna use it as an embed video (get its link from youtube) and display it in an iframe, so what I should save is only the video URL , how to accomplish that for an unlimited number of videos?

0 votesVote for this answer Mark as a Correct answer

Vukasin Andjelic answered on November 27, 2017 15:46

You can store this urls in custom table.Custom tables

0 votesVote for this answer Mark as a Correct answer

Farah El Agha answered on November 27, 2017 15:53

Vukasin Andjelic well I am kind of limited to using one page type to images, videos and reports, because I am using a repeater that has all the data, and I am displaying it with one transformation, for the images attachments it was very easy to use, but I am stuck with the videos links, so I dont think that using Custom tables will solve my problem, because I cant access it from my transformation.

0 votesVote for this answer Mark as a Correct answer

Vukasin Andjelic answered on November 27, 2017 16:06

Then set one field for videos urls long text field and separate urls with "|" or choose some separator, then in transformation split that field by separator.

0 votesVote for this answer Mark as a Correct answer

Farah El Agha answered on November 28, 2017 08:20

okay but how to loop over the items split if I am using ASCX format in the transformation?

0 votesVote for this answer Mark as a Correct answer

Vukasin Andjelic answered on November 28, 2017 11:54 (last edited on November 28, 2017 11:55)

You can create user control and in ASCX transformation You can call that user control and pass it value of the field, and then in user control to split that field value and represent that with user control. This is my solution for you.

<%@ Register Src="Path of user control" TagPrefix="bg" TagName="ShowImage" %>

<bg:ShowImage runat="server" id="ShowImageID" ValueOfField=<%# Eval("ValueOfField") %> />
0 votesVote for this answer Mark as a Correct answer

Farah El Agha answered on November 28, 2017 12:19

ok, but what should be in the Control? forgive me but I am a bit new to this, and it's not very clear the controls thing for me.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.