Hi,
Well, I would recommend you to use different approach based on creating custom web part (
custom web part ).
It could contain standard Media gallery web part and drop-down list.
Please take a look at following definition of this components:
<%@ Register Src="~/CMSWebParts/MediaLibrary/MediaGallery.ascx" TagName="MediaGallery" TagPrefix="uc1" %>
<uc1:MediaGallery ID="cntMediaGallery" runat="server"
HideFolderTree="true" TransformationName="Community.Transformations.MediaLibrary"
SelectedItemTransformation="Community.Transformations.MediaLibrarySelectedItem"
SeparatorTransformation="Community.Transformations.MediaLibraryItemSeparator"
HeaderTransformation="Community.Transformations.MediaLibraryHeader" FooterTransformation="Community.Transformations.MediaLibraryFooter"
FilterMethod="0" FileIDQueryStringKey="fileid" PathQueryStringKey="path" SortQueryStringKey="sort"
EnableViewState="false" />
<asp:DropDownList runat="server" id="ddl1" OnSelectedIndexChanged="onChange" AutoPostBack="true">
<asp:ListItem Text="czechcities" value="czechcities" ></asp:ListItem>
<asp:ListItem Text="czechnature" value="czechnature" Selected="True"></asp:ListItem>
</asp:DropDownList>You may use following code in code behind of this web part:
public partial class CMSWebParts_MediaLibrary_CustomMedia : CMSAbstractWebPart
{
protected void Page_Load(object sender, EventArgs e)
{
cntMediaGallery.MediaLibraryName = ddl1.SelectedValue;
cntMediaGallery.ReloadData();
}
protected void onChange(object sender, EventArgs e)
{
cntMediaGallery.MediaLibraryName = ddl1.SelectedValue;
cntMediaGallery.ReloadData();
}
}This way you achieve that Media gallery web part reload depending on current selected value in drop-down list.
Best regards,
Michal Legen