public static void GetImageManagerProperties(DialogOpener DialogOpener)
{
try
{
FileManagerDialogParameters imageManagerParameters = new FileManagerDialogParameters();
string[] strDocumentPath = new string[1] { <<Image Path>>};
imageManagerParameters.ViewPaths = strDocumentPath;
imageManagerParameters.UploadPaths = strDocumentPath;
imageManagerParameters.DeletePaths = strDocumentPath;
imageManagerParameters.MaxUploadFileSize = 5000000;
// If you don't set the following property, the default value will be used
// imageManagerParameters.SearchPatterns = new string[] { "*.jpg" };
Telerik.Web.UI.
DialogDefinition imageManager = new Telerik.Web.UI.DialogDefinition(typeof(ImageManagerDialog), imageManagerParameters);
imageManager.ClientCallbackFunction =
Telerik_Constants.ImageManagerFunction;
imageManager.Width =
Unit.Pixel(694);
imageManager.Height =
Unit.Pixel(440);
//If you need to customize the dialog then register the external dialog files
//imageManager.Parameters["ExternalDialogsPath"] = "~/EditorDialogs/";
DialogOpener.DialogDefinitions.Add(
Telerik_Constants.ImageManagerFunction, imageManager);
}
catch (Exception ex)
{
}
}
}
Javascript in (.aspx) page
<
script language="javascript" type="text/javascript">
function ImageManagerFunction(sender, args)
{
var selectedItem = args.get_value();
var txt = $get('<%= txt_Image.ClientID %>');
if ($telerik.isIE)
{
txt.value = selectedItem.outerHTML;
//this is the selected IMG tag element
var strPath = args.value.getAttribute("src",2);
var img = document.getElementById('Image Tag Name');
img.src = strPath;
var hField = document.getElementById('Hidden Field to store the image');
hField.value = strPath;
var strImagename=strPath.split("/");
if(strImagename.length-1!="")
txt.value=strImagename[strImagename.length-1];
}
else
{
var path = args.value.getAttribute("src",2);
txt.value =
"<img src='" + path + "' />";
}
}
</script>
Calling the above method from Code behind file
Telerik_Controls.GetImageManagerProperties(ImgDialogOpener
);
Is this the right way to Call the DailogOpener properties (or) It can be only be invoked from Code Behind.
2. I am able to open the Image Manager if i have all the properties set in code behind file without calling it from common class file but if the image folder is huge with 1000 or 2000 images it is not trying to Load the images, I am not sure if that is because of the image folder size (or) because of the path specified.
But i am able to access the image manager when i specify a folder with 15 or 20 images
Your earliest help and suggestions are appreciated.
Regards,
Bose Thirumalai
<
ClientSettings>
<Scrolling AllowScroll="True" ScrollHeight="400px" UseStaticHeaders="true">
</ClientSettings>
<
asp:Button ID="btn1" runat="server" Text="Click me" OnClientClick="return Valdate();" OnClick="btn1_Click" />
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Width="100%">
<telerik:RadPanelBar runat="server" ID="RadPanelBar1" ExpandMode="SingleExpandedItem" Width="100%" >
<Items>
<telerik:RadPanelItem Expanded="True" Value="RegistrationInformation1" style="font-weight:bold" Text="Step 1: User Information" runat="server" Selected="true">
<Items>
<telerik:RadPanelItem Value="RegistrationInformation" runat="server">
<ItemTemplate>
<asp:Table ID="tblRegistration" BackColor="#eeeeee" Width="100%" runat="server" >
</asp:Table>
<table width="100%">
<tr>
<td align="right">
<asp:Button ID="btn1" runat="server" Text="Click me" OnClientClick="return Valdate();" OnClick="btn1_Click" />
</td>
</tr>
</table>
</ItemTemplate>
</telerik:RadPanelItem>
</Items>
<CollapseAnimation Duration="100" Type="None" />
<ExpandAnimation Duration="100" Type="None" />
</telerik:RadPanelBar>
I am reffering same example .Here is following link.