PageBrowser.aspx popup dialog in button click event in view mode

Vote:
 

A page in view mode has a text box and a button. On button click we would like to bring the

/edit/pagebrowser.aspx  Dialog popup. When a page is selected in the Page Browser  the page

will be populated in the text box on the page in view mode.

We are able to bring the PageBrowser popup, but the select button does not function.

 


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="head1" runat="server">
    <title>FIFABlankPage</title>

    <script language="javascript" type="text/javascript">
    function OpenGetPageDialog()
    {  
        document.getElementById('PageAddValue').value = "";
        document.getElementById('PageAddText').value = "";

        EPi.CreatePageBrowserDialog('<%=

EPiServer.UriSupport.ResolveUrlFromUIBySettings("edit/pagebrowser.aspx")

%>','','False','False','PageAddText','PageAddValue','en', PageDialogClosed);
    }
   
    function PageDialogClosed(returnValue, callbackArguments) {
        if (document.getElementById('PageAddValue').value.length > 0) {
            // document.getElementById('PageAddValue') contains the PageId
            AddPage(document.getElementById('PageAddText').value,

document.getElementById('PageAddValue').value);       
        }
    }
    </script>
</head>
<body>
    <form runat="server" id="form1">
    <div>
    <asp:TextBox runat="server" ID="PageAddText"></asp:TextBox>
    <asp:TextBox runat="server" ID="PageAddValue"></asp:TextBox>
    <asp:Button runat="server" ID="btnBrowse" Text="Browse"

OnClientClick="OpenGetPageDialog()" />
    </div>
    </form>
</body>
</html>

 


I am able to view the pagebrowser but when I select a page it is not returning the selected page to the 'PageAddText' textbox

#20422
May 28, 2008 14:43
Vote:
 

I recognize that code.. ;)

First of all you won't find any inputs with the id PageAddText and PageAddValue cause the runat=server will change the id.

Second error is the AddPage-function that is non existent in your code.

 

#20436
May 29, 2008 11:50
Vote:
 
Can you please provide me the complete code, because I am not able to find it searching EPiServer Forum.
#20457
May 30, 2008 11:29
Vote:
 
No, I can't provide the complete code, but in your javascript-methods, change PageAddText to <%= PageAddText.ClientID %> and do the same with PageAddValue and you're halfway there.
#20463
Jun 01, 2008 10:42
Vote:
 

I have already changed my code to <%=PageAddText.ClientID%> even before you replied.

I tried putting a alert in System.js just after the PageBrowser popup loads. Then when I click select button in the popup I can see the PageAddText and PageAddValue getting loaded (with the selected page name and ID) in the main window. But once I click the OK button in the alert box, the values are getting cleared in the text boxes.

 

#20464
Jun 02, 2008 6:47
Vote:
 

Hi,

You can also think of using HyperLinkProperties.aspx page (which in turn opens the PageBrowser)

FYI, I open HyperLinkProperties.aspx on button click using the following JS code:-

<script type='text/javascript' src="<%# EPiServer.UriSupport.ResolveUrlFromUtilBySettings("javascript/episerverscriptmanager.js") %>"></script>

<script type='text/javascript' src="<%# EPiServer.UriSupport.ResolveUrlFromUIBySettings("javascript/system.js") %>" ></script>

<script type='text/javascript' src="<%# EPiServer.UriSupport.ResolveUrlFromUIBySettings("javascript/system.aspx") %>" ></script>

 

<script type="text/javascript">

 

function AddPageURL(postbackCtrlId)

{

ProcessLinkDialog(postbackCtrlId, "", "", "", "",-1, "");

}

 

function ProcessLinkDialog(postbackCtrlId, existingLink, existingTitle, existingText, existingTarget, index , callingLanguageBranch)

{

var url = '<%# EPiServer.UriSupport.ResolveUrlFromUIBySettings("editor/dialogs/HyperlinkProperties.aspx") %>';

url += '?url='+ existingLink;

 

var returnvalue;

if(callingLanguageBranch.length=='undefined')

{

callingLanguageBranch = '<%# Page.Request.QueryString["epspagelanguagebranch"] != null ? Page.Request.QueryString["epspagelanguagebranch"] : "" %>';

}

 

var pageId = '<%# Page.Request.QueryString["pageid"] != null ? Page.Request.QueryString["pageid"] : "0" %>';

var parentPageId = '<%# Page.Request.QueryString["parentId"] != null ? Page.Request.QueryString["parentId"] : "0" %>';

var folderId = '<%# Page.Request.QueryString["folderId"] != null ? Page.Request.QueryString["folderId"] : Page.Request.QueryString["pageid"] %>';

 

var linkAttributes = new Object();

linkAttributes.href = existingLink;

linkAttributes.target = existingTarget;

linkAttributes.language = callingLanguageBranch;

linkAttributes.title = existingTitle;

linkAttributes.text = existingText;

linkAttributes.imageDialogUrl = "";

linkAttributes.resizeDialogUrl = "";

linkAttributes.parentWindow = window;

linkAttributes.fileManagerBrowserUrl = '<%# EPiServer.UriSupport.ResolveUrlFromUIBySettings("edit/FileManagerBrowser.aspx") %>?id=' + pageId + '&parent=' + parentPageId + '&folderid=' + folderId;

 

var dialogArguments = linkAttributes;

var features = {width: 460, height: 412};

var callbackArguments = new Object();

callbackArguments.postbackCtrlId = postbackCtrlId;

callbackArguments.index = index;

callbackArguments.callingLanguageBranch = callingLanguageBranch;

 

 

EPi.CreateDialog(url,OnEPiDialogClosed,callbackArguments,dialogArguments,features);

}

 

 

function OnEPiDialogClosed(returnValue)

{

if (returnValue != undefined && returnValue != 0 && returnValue != -1)

{ //do your stuff here Haridaas

}

}

 

Enjoy EPi

Anadi

#20472
Jun 02, 2008 13:55
Vote:
 

Hi,

You can also think of using HyperLinkProperties.aspx page (which in turn opens the PageBrowser)

FYI, I open HyperLinkProperties.aspx on button click using the following JS code:-

<script type='text/javascript' src="<%# EPiServer.UriSupport.ResolveUrlFromUtilBySettings("javascript/episerverscriptmanager.js") %>"></script>

<script type='text/javascript' src="<%# EPiServer.UriSupport.ResolveUrlFromUIBySettings("javascript/system.js") %>" ></script>

<script type='text/javascript' src="<%# EPiServer.UriSupport.ResolveUrlFromUIBySettings("javascript/system.aspx") %>" ></script>

 

<script type="text/javascript">

 

function AddPageURL(postbackCtrlId)

{

ProcessLinkDialog(postbackCtrlId, "", "", "", "",-1, "");

}

 

function ProcessLinkDialog(postbackCtrlId, existingLink, existingTitle, existingText, existingTarget, index , callingLanguageBranch)

{

var url = '<%# EPiServer.UriSupport.ResolveUrlFromUIBySettings("editor/dialogs/HyperlinkProperties.aspx") %>';

url += '?url='+ existingLink;

 

var returnvalue;

if(callingLanguageBranch.length=='undefined')

{

callingLanguageBranch = '<%# Page.Request.QueryString["epspagelanguagebranch"] != null ? Page.Request.QueryString["epspagelanguagebranch"] : "" %>';

}

 

var pageId = '<%# Page.Request.QueryString["pageid"] != null ? Page.Request.QueryString["pageid"] : "0" %>';

var parentPageId = '<%# Page.Request.QueryString["parentId"] != null ? Page.Request.QueryString["parentId"] : "0" %>';

var folderId = '<%# Page.Request.QueryString["folderId"] != null ? Page.Request.QueryString["folderId"] : Page.Request.QueryString["pageid"] %>';

 

var linkAttributes = new Object();

linkAttributes.href = existingLink;

linkAttributes.target = existingTarget;

linkAttributes.language = callingLanguageBranch;

linkAttributes.title = existingTitle;

linkAttributes.text = existingText;

linkAttributes.imageDialogUrl = "";

linkAttributes.resizeDialogUrl = "";

linkAttributes.parentWindow = window;

linkAttributes.fileManagerBrowserUrl = '<%# EPiServer.UriSupport.ResolveUrlFromUIBySettings("edit/FileManagerBrowser.aspx") %>?id=' + pageId + '&parent=' + parentPageId + '&folderid=' + folderId;

 

var dialogArguments = linkAttributes;

var features = {width: 460, height: 412};

var callbackArguments = new Object();

callbackArguments.postbackCtrlId = postbackCtrlId;

callbackArguments.index = index;

callbackArguments.callingLanguageBranch = callingLanguageBranch;

 

 

EPi.CreateDialog(url,OnEPiDialogClosed,callbackArguments,dialogArguments,features);

}

 

 

function OnEPiDialogClosed(returnValue)

{

if (returnValue != undefined && returnValue != 0 && returnValue != -1)

{ //do your stuff here Haridaas

}

}

 

Enjoy EPi

Anadi

#20473
Jun 02, 2008 13:56
Vote:
 

Hi,

Did you manage to make it work? If so, can you advice how to addpt the code above to use LinkCollection instead?

Thanks

#50061
Apr 11, 2011 18:58
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.