MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

iframe Name field editing? (Closed) (Mono Support )

Viewed 72861 time(s), 12 post(s) 3/26/2012 5:35:14 PMby erin0201
erin0201

erin0201

3/29/2012 1:00:45 PM
Ok I found the problem!

I had tried a lot of different jquery code to get it to work when I first tried loading the one page inside an iframe of a monox page and couldn't get anything to work.  When I loaded the main page inside an iframe and then opened the new iframe in an iframe on the monox page beside it instead of within that page, I got it to work in Firefox and Chrome and not IE8, but I just went back and looked at my old code now that I started using the two iframes theory and that has been working and changed my code back and it now works in IE8, Firefox, and Chrome!

Hopefully this might help someone else in the future!
Here is the fixed and working jquery code:
function openiframe()
 {
     document.getElementById("IframeDir").style.display = "block"
      
     $().ready(function () {
            var $scrollingDiv = $("#IframeDir");
 
            $(window).scroll(function () {
                $scrollingDiv
                .stop()
                .animate({ "marginTop": ($(window).scrollTop() + -150) + "px" }, "slow");
                 
            });
        });
 
 }
Rated 4.00, 1 vote(s). 
453 Reputation 61 Total posts
erin0201

erin0201

3/26/2012 5:35:14 PM
Hello!

I have been using MonoX 4.5 for a little while now to build a new intranet.
However, I already have a Gridview that binds to an access database of employees for a directory. I had the target on one of the fields set to open more information for an employee in an iframe upon clicking a link. In order to do this I have to set the target to the name of the iframe.

Is there anyway to edit the name of the iframes? Even if I have to go into the database manually to do it at this point, I would love to have the control.

Thanks!
Erin0201
This content has not been rated yet. 
453 Reputation 61 Total posts
shawndg

shawndg

3/27/2012 3:00:43 AM
Scatch my last post....

May want to look into this..

https://developer.mozilla.org/en/DOM/window.postMessage

may be a better solution and part of your problem..

By default I dont think MonoX controls will support this unless you code it in yourself.
This content has not been rated yet. 
1871 Reputation 252 Total posts
erin0201

erin0201

3/27/2012 11:15:09 AM
I'm not sure why Monox couldn't already support this. The iframe handles the task itself as long as you can enter the name property.
I've had this working on an ASP.NET 4.0 website just fine up until trying to move everything over to MonoX. I'm thinking it is because I'm not seeing how to edit the name property of the iframe. Normally you can place an iframe on the page, put a target in a link that points to the name of an iframe, and that link will open in the iframe. I'm not sure where the properties for the iframe are stored I guess is what I'm asking.

Are they stored in the database somewhere that I could go in and manually edit the iframe property, or is it stored somewhere in the MonoX folder of the website and I'm just not finding the right spot? I'm still trying to get the hang of the fact that the "web parts" code don't actually show up on a page when you pull it up in Visual Studio Web Developer. So I was guessing that their information is stored in the database. If it's stored somewhere else, where would I find it?

Thanks for your suggestion! I will read through it, but it's really not the way I want to go.
This content has not been rated yet. 
453 Reputation 61 Total posts
shawndg

shawndg

3/27/2012 11:37:35 AM
Hi Erin,

If this is the case then If i was you I would just not use the standard MonoX Iframe part because according to the API it does not allow you to set its name.
The MonoX Iframe api is only showing the following iframe properties. AutoSize, Height, URL, and Width.

However, you could now instead just write into the aspx code of the page you are trying to place the iframe.. standard ,net iframe code.
And then you could set the name.

<iframe id="ifrDownload" name="ifrDownload" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" style="display: none;" src="Download.aspx"></iframe>

this code should work just fine with MonoX, it just wont be controlled by the MonoX webpart ui.
Rated 3.00, 1 vote(s). 
1871 Reputation 252 Total posts
erin0201

erin0201

3/27/2012 11:40:24 AM
Ok, that's what I was kind of wondering. I will try and go that route for now, but if anyone from MonoX is reading this, there really should be a way to edit the name of the iframe in the API, or at least by manually editing the database or code somewhere. If there is, please let us know! If not, please consider it for a future update!

Thanks for your suggestion Shawndg!
This content has not been rated yet. 
453 Reputation 61 Total posts
shawndg

shawndg

3/27/2012 11:51:18 AM
you know writing your own web part to allow this prob would be very easy if you are hell bent on making it work.

There are some web part tutorials on this web site that will point you in the right direction.
http://www.mono-software.com/blog/post/Mono/93/Building-a-custom-Web-part/

I started writing my own web parts before this tutorial was written but since then have often refereed to this tutorial for ref and it is a great little tutorial.
You can build your own web parts, and give them properties, etc.. pretty much do anything and present them to the MonoX ui for drag and drop.

This content has not been rated yet. 
1871 Reputation 252 Total posts
shawndg

shawndg

3/27/2012 2:51:19 PM
I got it to work but I did do it another way..

The idea behind this..
Use update panels to update each section of the page and control it as needed.
Set the url property of the Monox hard coded control via code ..
You could do this inside your grid view to set each url as desired.

Quick Example code.

<%@ Page
standard dec stuff.
%>

<%@ MasterType TypeName="MonoSoftware.MonoX.BaseMasterPage" %>

<%@ Import Namespace="MonoSoftware.MonoX.Resources" %>
<%@ Register Assembly="MonoX" Namespace="MonoSoftware.MonoX" TagPrefix="portal" %>

<%@ Register TagPrefix="MonoX" TagName="IFrameModule" Src="/MonoX/ModuleGallery/IFrameModule.ascx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cp" runat="server">

<asp:UpdatePanel ID="MainWrapPanel" runat="server" updatemode="Conditional">
<ContentTemplate>

<asp:UpdatePanel ID="IframePanel" runat="server" updatemode="Conditional">
<ContentTemplate>
<MonoX:IFrameModule runat="server" ID="IFrameModule1" />
</ContentTemplate>
</asp:UpdatePanel>


<asp:UpdatePanel ID="IframeCPanel" runat="server" updatemode="Conditional">
<ContentTemplate>
<asp:Button Id="test" runat="server" onclick="test_Click" text="test" />
</ContentTemplate>
</asp:UpdatePanel>


</ContentTemplate>
</asp:UpdatePanel>


</asp:Content>


I then put in the code behind..

protected void test_Click(object sender, EventArgs e)
{
IFrameModule1.Url = "www.bla.com";
IframePanel.Update();
}


to control it.. this may be the route to go..
It works.. make sure to turn the aspx page into a web app.. right click.. convert to web app for code behind to work on the control.

Note: I tried adding attributes to the MonoX control using standard .net attribute.add but nothing would render correctly so instead i came up with the solution above.
This content has not been rated yet. 
1871 Reputation 252 Total posts
erin0201

erin0201

3/27/2012 3:27:40 PM
Wow, thanks for figuring out another solution, Shawndg!

I will definitely look into this for future pages, but for now I just went with your first suggestion and hard-coded my iframes into the page.

I have it partially working by hard-coding the iframes into the page, but I'm having a problem getting the javascript that controls the opening and closing of the second iframe to fire in IE8 where I didn't have that problem doing it on a normal ASPX page in my old version of the site. I'm wondering if it's because my javascript is loaded into the body of the page instead of into the header since MonoX didn't have an asp content control section for the header and IE8 doesn't like it. It works fine in Firefox and Chrome.

Do you know how to create a header content control in MonoX? I don't see any pages that have a header content control that refers to a header and when I tried creating one like the content1 aspx content control and named it header1, I kept getting errors that there weren't any headers with that name.
This content has not been rated yet. 
453 Reputation 61 Total posts
shawndg

shawndg

3/27/2012 3:51:42 PM

What you are trying to do i think is referring to the creating another content header inside the default.aspx file.
Now, this is possible but you have to keep in mind that all content controls are associated with the master.aspx file.

You can either enter a new one your self into the header itself.. somehow i am sure..
Prob can even write it right in as html code really.

Or you can add your javascript using some of the monox api provided in page load or update panel load if using one..

protected void Page_Load(object sender, EventArgs e)
{
string javascripturl = "test.js";
MonoSoftware.MonoX.Utilities.JavascriptUtility.RegisterClientScriptInclude(this, this.GetType(), "myscript", javascripturl);
}


This will inject the script into the monox header on page load.
This content has not been rated yet. 
1871 Reputation 252 Total posts
denis

denis

3/28/2012 9:23:50 PM
Erin, could we see the full code of your page? I am not sure that I understand everything, especially the part where MonoX apparently breaks some functionality that otherwise works in vanilla ASP.NET.
This content has not been rated yet. 
7207 Reputation 956 Total posts
1 2