<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        <script type="text/javascript">  
        function ImageManagerFunction(sender, args)  
        {  
            var selectedItem = args.get_value();  
            
            
            var txt = $get('<%= TextBox1.ClientID %>');  
            if ($telerik.isIE)  
            {  
                txt.value = selectedItem.outerHTML;  //this is the selected IMG tag element
            }  
            else  
            {   
                var path = args.value.getAttribute("src",2);  
                txt.value = "<img src='" + path + "' />";  
            }  
        }  
         
        function DocumentManagerFunction(sender, args)  
        {  
            //debugger;
            var selectedItem = args.get_value();  
            var path = args.value.src;  
            
            var txt = $get('<%= TextBox1.ClientID %>');  
            if ($telerik.isIE)  
            {  
                txt.value = selectedItem.outerHTML;                 
            }  
            else  
            {  
                var path = args.value.pathname;  
                txt.value = "<a href='" + path + "'>" + path  +"</a>";  
            }  
        }  
        
        function OpenDocManager()
        {
            var args = new Telerik.Web.UI.EditorCommandEventArgs("DocumentManager", null, document.createElement("a"));
            args.CssClasses = [];
            
			$find('<%= DialogOpener1.ClientID %>').open('DocumentManager', args);
		}
        </script> 
                 
        <asp:TextBox runat="server" ID="TextBox1" Width="400px"></asp:TextBox><br /> 
        <telerik:dialogopener runat="server" id="DialogOpener1"></telerik:dialogopener> 
        <button onclick="$find('<%= DialogOpener1.ClientID %>').open('ImageManager', {CssClasses: []});return false;">Open ImageManager</button> 
        <button onclick="OpenDocManager();return false;">Open Document Manager</button> 

    </form>
</body>
</html>
