For the sake of the public I will post Miroslav's suggestion and my solution.
I decided not to add a parameter by changing the RenderedHTML property.
Miroslav had another suggestion:
Ok, the only other solution with I’m aware is to store your additional information not in the URL as query string, but in data of your document. You can create custom field for your document type and fill such information for each document. In code behind of your web part/template you can access the current document information using following example code:
CMS.CMSHelper.CMSContext.CurrentDocument.GetValue("CustomDocumentTypeFieldName")
And you can dynamically set your web part parameters in code behind of your web part/template according to data from current document. I’m not aware of any other solution here.
I went with her solution.
I created a new document type with the parent type set to the Page (Menu Item) and I added a custom attribute called
MediaGalleryPath to be used for the
MediaLibraryPath on the MediaGallery web part.
I then followed the directions from the documentation
here to dynamically set the MediaLibraryPath property on the web part. Here is the code:
protected void Page_Init(object sender, EventArgs e)
{
//Check if the document has the media gallery path as a custom field
if (CMS.CMSHelper.CMSContext.CurrentDocument.ContainsColumn("MediaGalleryPath"))
{
//Set the media gallery's folder to the folder path in the custom field.
this.MediaGalleryControl.MediaLibraryPath = CMS.CMSHelper.CMSContext.CurrentDocument.GetValue("MediaGalleryPath").ToString();
//Reload control with dynamically set properties (required)
this.MediaGalleryControl.ReloadData();
}
}
So now the user can create a new Page with my new document type and set the MediaGalleryPath field in CMS Desk and the correct Media Library Folder will be displayed.
I hope this helps others.
Oran