Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > MediaSelector callbacks View modes: 
User avatar
Member
Member
zevinganez - 9/6/2011 9:55:18 AM
   
MediaSelector callbacks
Hi all,

I'm have a MediaSelector on my form control, and I want to know when the user selected a file from the media library. Is there any way?

My HTML is:
<div>
<div style="margin-bottom: 5px;">
<cms:MediaSelector ID="mediaSelector" runat="server" Visible="true" />
</div>
<asp:ImageButton ID="addNewMedia" runat="server"
ImageUrl="~/images/newObject.png"
onclick="addNewMedia_Click" />
</div>

On the initialization of the control I have:

private void SetupControls()
{
// Configuration of media dialog
DialogConfiguration config = new DialogConfiguration();
config.SelectableContent = SelectableContentEnum.OnlyImages;
config.OutputFormat = OutputFormatEnum.URL;
config.HideWeb = false;
config.HideContent = true;
config.HideAttachments = true;
config.ContentSites = AvailableSitesEnum.OnlyCurrentSite;
config.DialogWidth = 90;
config.DialogHeight = 80;
config.UseRelativeDimensions = true;
config.LibSites = AvailableSitesEnum.OnlyCurrentSite;


this.mediaSelector.UseCustomDialogConfig = true;
this.mediaSelector.DialogConfig = config;
this.mediaSelector.ShowPreview = false;
this.mediaSelector.ShowTextBox = true;
this.mediaSelector.IsLiveSite = this.IsLiveSite;
}

Thanks.
Cheers,

User avatar
Member
Member
kentico_michal - 9/7/2011 7:10:35 AM
   
RE:MediaSelector callbacks
Hello,

Could you please describe this request and what you want to accomplish in more detail?

Did you creat a custom form control?

Anyway, you can get the selected value using the Value property of MediaSelector control.

Thank you.

Best regards,
Michal Legen

User avatar
Member
Member
zevinganez - 9/7/2011 8:21:33 AM
   
RE:MediaSelector callbacks
Hi there,

Off course.
What I wnat to know is if there is any kind of event driven API for the MediaSelector, in a way that is possible to hookup to the selected media file and others, etc. To be able to add business logic after the selection of those files.

Thank you.
Cheers,

User avatar
Member
Member
kentico_michal - 9/8/2011 7:54:24 AM
   
RE:MediaSelector callbacks
Hello,

Regrettably, the MediaSelector control does not provide any event that you could use in this case. Anyway, you can see this control in the following file: ~\CMSFormControls\System\IconSelector.ascx.cs

Best regards,
Michal Legen