Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUsing Popup To Show A CustomPage...Using Popup To Show A CustomPage...
Previous
 
Next
New Post
4/11/2012 5:28 PM
 

See my responses below...

Ben Santiago wrote:

Mike,

That didn't answer my question. But let me first address your new post.

Regarding the "element" in the DNN Manifest, you understand incorrectly. Just because your site has other popups that work means nothing at all. It just means that your DNN Instance is set to allow them, that is all.  Like I previously stated in my post:
You missed a property inside your DNN Manifest file: True
Without this property, your page will never "PopUp" [correctly, if at all].
If you do not "define" your ControlPage as "Supporting Popup", then it will not Popup correctly (if at all) because according to what DNN knows, this particular page is not a "Popup" page. Once defined at a "Supports Popup" page, then the EditURL() command will automatically return a URL formatted with the JavaScript that will "popup" your page. 

There's really no point debating whether <supportsPopUp> is required or not.  I believe it is enabled by default based on blogs I've read on dotnetnuke.com blogs.  In any case, whether I have the element included in my manifest file or not, the result from the EditURL() call always returns the following, which you can see does include the appropriate javascript call... 

dnnModal.show('http://dnndev/CustomPage1/CustomChildPage1/tabid/90/ctl/FTS-RSS/mid/504/Default.aspx?popUp=true',/*showReturn*/false,550,950,true,'') 

On a side note, I've always called the popup from server-side code, which means I needed to register a JavaScriptBlock to activate the "popup". You are trying to embed your code directly using JavaScript from what I can gather of your posts, although theoretically it shouldn't be a problem, I I have never done it that way.

If you look at the code I posted initially, you'll see that it is the same code that was used successfully by you earlier in the thread... server side code.

Now, running from an "Installed Package" and running directly from your "Source Code" is different. I know the difference.

In either case, you have to make sure your DNN Manifest is correct as I stated above. I have attempted with and without <supportsPopUps> element to no avail.  

However, if you are running from "Source Code" and you have already initially added the Module, you need to EDIT the module definition as I explained in my previous post...add the new ControlPage you created because you added it after-the-fact and the DNN Instance has no knowledge of it, and be sure to activate the "Supports Popup" flag on the ControlPage in the Module Definition, otherwise as stated before it will not "popup" correctly if at all.  I have both edited the module as you describe and included the element in my manifest and reinstalled the package.  No change in behavior.

Lastly, as for your question "Does the module that I want to display in the PopUp have to actually be on the page that the hyperlink is that will launch the popup?"... I have no clue what you mean by this. When you are coding a Module, ALL your ControlPages are within the Module you are coding. If you are referring to accessing a completely separate Module, then you need to know that you cannot access ControlPages of other Modules.  

My point is this... Given that the path generated by EditURL includes in it the tabid of the page that I am launching the popup from, does the module have to be added to a hidden container on that page in order for the url path to locate and navigate to its display.  Nevermind... I'll just try it and know the answer for myself.

EditURL() and NavigateURL() does not support cross-module communication. Now the caveat to this statement is that if you want, you "could" create Direct SQL Queries against the DNN Core Tables to determine the ModuleID of another Module and then manually build a URL to which you can use in a ResponseRedirect() command. As for the SQL statements needed, only you can figure that out as these are your modules.

Ultimately, the issue is not the generation of the popup itself.  I am getting the popup.  I can see the html source within the iframe of the popup.  But the source that would be generated from my control is not within the iframe.  Also, when I attempt to navigate to the URL contained within the popup javascript call, it does not display the content from my module.

Guess I'll just keep digging for a solution.

 

 
New Post
4/20/2012 6:39 AM
 

Hi Ben,

would you please be so kind as to send me  your code, too?
I cant find any way to private message you or something. I dont want to publish my emailadress here.
I think the best would to post your code here anyways. i think many people are having the same problem and cant find any answer (like me). Please try to post your code here.

best regards,

marc

 
New Post
4/20/2012 9:53 AM
 

Marc,

Sure, I have no problem posting my code.  Posting code on this forum is not very easy or reliable...it tends to get changed or otherwise messed up when posting. I will try my best. I posted comments where needed to warn about this forums code-bashing areas.  :-)

Steps to Enable DNN PopUp of a ControlPage Within Your Module

DNN Setup: (Note: Without these settings your ControlPage will not work as a PopUp)
1) Open your DNN Manifest, and add True to the ModuleControl you want to make a PopUp
2) If already created within your DNN Instance, you must edit the DNN Extention manually as well:
     Goto: Host>Extensions>[Your Module]>Module Definitions>[ControlPage To Make PopUp]
     Check the box that says "Supports Popups"

Code-Behind: (Note: I Use The Server-Side Execution Method In Most Cases, I Haven't Tested The Client-Side Method Myself But The Code Below Should Work (I Believe...))


'***************************************
' Ensure Your Portal Instance Allows PopUps
'***************************************
If (PortalSettings.EnablePopUps) Then
     '***************************************
     ' Initialize Variables
     '***************************************
     Dim strRedirectURL As String
     
     '***************************************
     ' Create URL To ControlPage (Replace [ControlPageKey] w/ Your Actual Key)
     '   Note: Version 1 - Use As A Straight Call To The ControlPage
     '             Version 2 - Use If You Have To Pass QueryString Parameters
     '                               Use String.Format() For Multiple "Dynamic" Values To Make Building Easier
     '                               Seperate Each Parameter with an "&" as shown below
     '***************************************
     strRedirectURL = EditUrl("[ControlPageKey]")
     strRedirectURL = EditUrl(String.Empty, String.Empty, "[ControlPageKey]", "Parameter1=Value&Parameter2=Value")

     '***************************************
     ' Result: The Above Code Will Return A String In The Following Format
     '               Preface The Below Code with "javascript" and a ":" (This Forum Removes That From The String When Posting)
     '     dnnModal.show('http://[SiteURL]/[ModuleName]/tabid/[TabID]/ctl/[ControlPageName]/mid/[ModuleID]/Default.aspx?popUp=true',/*showReturn*/false,550,950,true,'')
     ' If You Do Not See The Above URL Format, And Instead See A Simple a Direct URL, You Did Not Complete The DNNSetup Described Above
     '***************************************

     '***************************************
     ' Default PopUp Size 550h x 950w
     '  If You Need To Change The Size, Perform Your Replacement Here (Example Below)
     '***************************************
     strRedirectURL = strRedirectURL.Replace(",550,950,", ",400,500,")

     '***************************************
     ' SERVER-SIDE EXECUTION STYLE
     ' Register/Execute The Script On Your Page
     '   You Can Make [Popup_MyPage] Any UNIQUE Key You Like
     '   WARNING: When Converting To JavaScript Block, Remove The Initial "javascript" and ":"
     '                      Replace The Semi-Colon Below With A Colon (Again This Forum Messes With The Code Posted)
     '***************************************
     If (strRedirectURL.ToUpper().StartsWith("JAVASCRIPT;")) Then strRedirectURL = strRedirectURL.SubString(11)
     Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "[Popup_MyPage]", strRedirectURL, True)

     '***************************************
     ' CLIENT-SIDE EXECUTION STYLE
     ' If You Want To Run This On The ClientSide, Then Assign The Contents of strRedirectURL To A Method
     ' On Whichever Control You Want To Execute It (Example Below)
     '***************************************
     objMyCommandButton.Attributes.Add("onClick", strRedirectURL)
Else
     ' Display Error: PopUps On This Site Have Been Disabled. Please Enable PopUps To Use This Modules Full Functionality.
End If

I hope this helps!


Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
New Post
4/23/2012 6:01 AM
 
Hi Ben,

thank you very much for your code and your time investmet to make your code "forumable" :)
My string looks like this before it gets included into the scriptblock:

dnnModal.show('http://localhost/dnn_6x/Stellplätze/Stellplätze/tabid/110/ctl/Error/mid/658/Default.aspx?popUp=true',/*showReturn*/false,550,950,true,'')

"Error" is my ControlKey to call.
If set every "supportPopups" to true and cant find any problem here :(
I dont get any DotNetNuke Error or something (in the "logviewer") as well.
its not working. If I click on my testButton to call the popup I get a page postback and then the site is scrolling to the position where I clicked on the button. Nothing else happens :(
Do you have any suggestions?
*Edit:
If I use the ClientSide the popup will open but close after about 1 second.


best regards,

marc
 
New Post
4/23/2012 8:31 AM
 

Marc,

I had the same problem myself when I first started using PopUps. The reasons for your stated behavior are listed below:

Server Side: If you fail to remove the "javascript :" (remove the space between 'javascript' and the ':') portion at the begining of the URL string, the PopUp will not work. It will simply perform a postback, leaving you at the same position where you started. This is why I added the IF statement right before the RegisterClientScriptBlock() method to my code to remove that portion from the string. I am assuming you might have accidentally overlooked that?

Client Side: If you use an ASPButton (I am not sure which other controls do the same, probably LinkButton as well), by default ASP adds it's own "WebForm_DoPostBackWithOptions()" to the "onClick" event which causes a PostBack, this is how those button get their default PostBack behavior so you can execute Server-Side code. When you add your own custom "onClick" JavaScript code, it "pre-pends" the code to the code already autogenerated. Which means that your custom code runs, but then the second PostBack (the default one) occurs immediatly after it, which is what causes your PopUp to immediately close. You have two choices, use a control that ASP doesn't autocreate a postback option for (ie: Simple HTML control, not ASP ones),  or append "; return false;" to the end of your URL, which then causes an immediate return bypassing the second PostBack method.


Ben Santiago, MCP Certified & A+ Certified
Programmer Analyst
(SQL, FoxPro, VB, VB.Net, Java, HTML, ASP, JSP, VBS, Cognos ReportNet)
 
Previous
 
Next
HomeHomeDevelopment and...Development and...Building ExtensionsBuilding ExtensionsModulesModulesUsing Popup To Show A CustomPage...Using Popup To Show A CustomPage...


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out