API
Version 7.x > API > popup windows View modes: 
User avatar
Member
Member
mehrdadilchizadeh-gmail - 1/11/2014 4:58:54 AM
   
popup windows
hi

i need to open windows or zone whit popup... i want show my popup like open webpart propertis in cms desk (kentico cms 7)


PLZ HELP ME


THANK YOU

User avatar
Kentico Support
Kentico Support
kentico_filipl - 1/11/2014 7:11:56 AM
   
RE:popup windows
Hi,

Do you mean you want to open some page in a new window? If so, you can set the Javascript command in CMS Desk -> Content -> <your document> -> Properties -> Navigation -> Menu actions of the document to a command like this:
window.open('http://www.mypage.com');return false;

This will ensure clicking the document link will open the redirected site in a new tab or window of the browser.

Best regards,
Filip Ligac

User avatar
Member
Member
mehrdadilchizadeh-gmail - 1/11/2014 7:50:23 AM
   
RE:popup windows
hi
ok but this code not best effect to open pop up page....
i need open with effect like in cms desk webparts properties

in back popup page color is gray or black


thank you Filip Ligac

User avatar
Kentico Support
Kentico Support
kentico_filipl - 1/11/2014 10:21:32 AM
   
RE:popup windows
Hi,

I see, you would like to create a modal popup window like in these examples, is that right? Simple modal popups

If that is the effect you want to achieve, you can take an inspiration on the link above which suggests implementing such features using JavaScript. Unfortunately there is no built-in web part in Kentico CMS which would enable you to open content in a modal window so you would have to develop it in a custom code by yourself.

Best regards,
Filip Ligac

User avatar
Member
Member
mehrdadilchizadeh-gmail - 1/12/2014 12:02:23 AM
   
RE:popup windows
thank you
yes i want this but i need develop by behind code in asp.net(C#) for load url special
i want to edit button in gridview to show detail for edit in popup windows whit same effect


plz help me

THANK YOU

User avatar
Kentico Support
Kentico Support
kentico_filipl - 1/13/2014 2:34:17 AM
   
RE:popup windows
Hi,

I found an extension package for Kentico CMS which should serve you well for your purposes. It contains a web part which enables you to show content in modal windows.

All you need to do is apply the hotfix 7.0.53 or higher and import the package which is linked in the article to your Kentico CMS instance. Aftewards, there should be a new web part Modal ColorBox available in the list of all web parts which you can use. Please see the following Knowledge Base article for more details - Display content in a modal window.

Best regards,
Filip Ligac

User avatar
Member
Member
mehrdadilchizadeh-gmail - 1/13/2014 5:13:39 AM
   
RE:popup windows
thank you

i add poll in Content HTML and this webpart show me this code:

{^widget|(name)Poll|(PollCodeName)1|(ShowGraph)True|(CountType)0|(ShowResultsAfterVote)True|(CheckVoted)True|(image_guid)27e6fe1f-c5d9-484f-b42b-adae3a492004|(widget_displayname)Poll^}

Close

Plz help me


User avatar
Kentico Support
Kentico Support
kentico_filipl - 1/14/2014 2:01:08 AM
   
RE:popup windows
Hi,

You need to adjust code behind of the web part a little to make it display polls, forms and other elements which were inserted through CK (WYSIWYG) editor.

Please add these controls to the markup of the web part (~/CMSWebParts/ModalWindow/ModalColorBox.ascx):
<asp:PlaceHolder runat="server" ID="mycontent">
<asp:Literal ID="ltlcontent" runat="server" EnableViewState="false" />
</asp:PlaceHolder>

And replace the original else condition in SetupControl() method with the following:
else
{
ScriptHelper.RegisterScriptFile(this.Page, "~/CMSWebParts/ModalWindow/ModalColorBox_files/jquery.min.js");
ScriptHelper.RegisterScriptFile(this.Page, "~/CMSWebParts/ModalWindow/ModalColorBox_files/jquery.colorbox.js");

string webPartID = ValidationHelper.GetString(this.GetValue("WebPartControlID"), Guid.NewGuid().ToString());
ltlLink.Text = "<a class='inline' id='link' href='#" + webPartID + "'>" + LinkHTML + "</a>";

ltlcontent.Text = "<div><div id='" + webPartID + "' style='padding:10px; background:#fff;'>" + ContentHTML + "</div></div>";
CMS.ExtendedControls.ControlsHelper.ResolveDynamicControls(mycontent);

string contentScript = "var $ = jQuery.noConflict(); $(document).ready(function () { $(\".inline\").colorbox({ inline: true, width: \"" + ModalWidth + "\" }); });";

ScriptHelper.RegisterStartupScript(Page, typeof(Page), webPartID, ScriptHelper.GetScript(contentScript));
}

Best regards,
Filip Ligac

User avatar
Member
Member
mehrdadilchizadeh-gmail - 1/14/2014 2:36:17 AM
   
RE:popup windows
thank you

but i have 2 problems :

1) show ltlcontent in down of ltlLink for ever...

2) for example i add a bizform but dont working ....

User avatar
Kentico Support
Kentico Support
kentico_filipl - 1/14/2014 3:52:52 AM
   
RE:popup windows
Hi,

1. If you do not want to show content of ltlcontent control, you can assign it a CSS style 'display:none' and keep removing this style dynamically on the link click through JavaScript.

2. I am not sure why BizForms are not working for you. Once I changed code of the web part according to my previous message, I could insert polls and forms without a problem. Could you specify or possibly take a screenshot of the issue?

Thank you.

Best regards,
Filip Ligac

User avatar
Member
Member
mehrdadilchizadeh-gmail - 1/14/2014 1:18:04 PM
   
RE:popup windows
dear sir;
i have to appreciate for your great advice in advance,
i have some problems and i wondered if you could help me.
Do you mind if you can explain more about JavaScript in firs part?
i will check the second part and i'll let you know if there are any problems.
sincerely yours

User avatar
Kentico Support
Kentico Support
kentico_filipl - 2/3/2014 3:54:28 PM
   
RE:popup windows
Hi,

So let's say you have a CSS class selector modalContent assigned to Content HTML part of Modal Colorbox web part which hides the element by default:
.modalContent {display: none;}

Then you have a function which removes this function and which is called upon onclick method of the Link HTML element:
<script type="text/javascript">
function removeClass()
{
// Check if class is assigned
if (document.getElementById("ModalColorBox").className.match(new RegExp('(\\s|^)modalContent(\\s|$)')))
{
// Remove class -> element is displayed
document.getElementById("ModalColorBox").className = document.getElementById("ModalColorBox").className.replace(( \\s|^)modalContent(\\s|$), '');
}
else
{
// Add class -> element is hidden
document.getElementById("ModalColorBox").className += "modalContent";
}
}
</script>


You can adjust the logic according to your needs, this was just an example how you can make the approach.

Best regards,
Filip Ligac