hi amit,
can you post your html i.e. .aspx code for page which you are displaying in right frame?
thanks,
satish.
Hi Satish
Thanks for your reply. But i dont this there is some problem with the code as it was working fine with the previous version and still works good if i open the page straight into window instead of opening it in frame. But anyhow here is the code for your consideration.
<%
@.PageLanguage="VB"AutoEventWireup="true"CodeFile="GlobalMaint.aspx.vb"Inherits="GlobalMaint" %><%
@.RegisterAssembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"Namespace="System.Web.UI"TagPrefix="asp" %><%
@.RegisterAssembly="AjaxControlToolkit"Namespace="AjaxControlToolkit"TagPrefix="ajaxToolkit" %><%
@.RegisterAssembly="CustomControls"Namespace="UNISYS.FE"TagPrefix="cc1" %><%
@.RegisterTagPrefix="CustControl"TagName="AdminHeading"Src="~/Common/PageComponents/AdminHeading.ascx" %><!
DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><
htmlxmlns="http://www.w3.org/1999/xhtml"><
headid="Head1"runat="server"><title>Global Filter Maintenance</title></
head><
body><CustControl:AdminHeadingID="AdminHeading1"runat="server"DisplayAdminLocationName="true"Heading=" "></CustControl:AdminHeading><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"/><br/><asp:UpdatePanelrunat="server"ID="UpdPanelphmessage"><ContentTemplate><tablecellspacing="0"cellpadding="0"width="610px"border="0"><tr><tdwidth="10"rowspan="5"nowrap></td></tr><tr><td><asp:placeholderid="phmessage"runat="server"></asp:placeholder></td></tr></table></ContentTemplate></asp:UpdatePanel><br/><asp:ObjectDataSourceID="odsAlphaPagingLetters"runat="server"OldValuesParameterFormatString="original_{0}"SelectMethod="AlphaNumericPager"TypeName="GlobalFiltersBL"></asp:ObjectDataSource><divstyle="margin-left: 10px"><tablewidth="100%"border="0"><tr><td><asp:RepeaterID="rptLetters"runat="server"DataSourceID="odsAlphaPagingLetters"OnItemCommand="rptLetters_ItemCommand"><ItemTemplate><asp:LinkButtonID="lnkLetter"runat="server"CommandName="Filter"Enabled='<%#Eval("IsEnabled")%>'Visible='<%# not(PagerLetterSelected(cstr(Eval("AlphaPagingItem")))) %>'Text='<%#Eval("AlphaPagingItem")%>'CommandArgument='<%# DataBinder.Eval(Container, "DataItem.AlphaPagingItem")%>'>
</asp:LinkButton><asp:LabelID="lblLetter"runat="server"Text='<%#Eval("AlphaPagingItem")%>'Visible='<%# PagerLetterSelected(cstr(Eval("AlphaPagingItem"))) %>'></asp:Label></ItemTemplate></asp:Repeater></td></tr></table><asp:GridViewID="gvwFilters"runat="server"AllowPaging="True"AutoGenerateColumns="False"CellPadding="5"DataKeyNames="GlobalFilterID"DataSourceID="odsGlobalFilters"ShowFooter="True"SkinID="GridViewTheme"><Columns><asp:TemplateField><ItemTemplate><asp:ImageButtonID="LinkButton2"runat="server"CausesValidation="true"CommandName="Delete"SkinID="iconTrashCan"/><asp:ImageButtonID="LinkButton1"runat="server"CommandName="Edit"SkinID="iconPencil"/></ItemTemplate><EditItemTemplate> </EditItemTemplate><ItemStyleWidth="42px"Wrap="False"/></asp:TemplateField><asp:TemplateFieldHeaderText="URL"><EditItemTemplate>
<%
-- <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"Text="Update"></asp:LinkButton><br />
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel"></asp:LinkButton>
--
%><%
-- <asp:Panel ID="gvwEditItemPanel" runat="server">--%><asp:DropDownListID="ddlEditURIType"runat="server"AutoPostBack="True"DataSourceID="odsURITypes"DataTextField="URITypeName"DataValueField="URITypeID"SelectedValue='<%# Bind("URITypeID") %>'></asp:DropDownList><asp:TextBoxID="txtEditItemURL"runat="server"Text='<%# Bind("FilterURL") %>'Width="256px"></asp:TextBox><ajaxToolkit:FilteredTextBoxExtenderID="ftxtURLAdd"runat="server"FilterType="Custom, Numbers, LowercaseLetters"TargetControlID="txtEditItemURL"ValidChars="%_~-.*/"></ajaxToolkit:FilteredTextBoxExtender><asp:TextBoxID="txtGlobalFilterID"runat="server"Text='<%# Bind("GlobalFilterID") %>'Visible="False"></asp:TextBox><asp:TextBoxID="txtFilterTypeID"runat="server"Text='<%# Bind("FilterTypeID") %>'Visible="False"></asp:TextBox><%--</asp:Panel>--%> <asp:ImageButtonID="ImageButton3"runat="server"CausesValidation="true"CommandName="Update"SkinID="iconTheTick"/><asp:ImageButtonID="ImageButton1"runat="server"CausesValidation="true"CommandName="Cancel"SkinID="iconCross"/></EditItemTemplate><ItemTemplate><asp:TextBoxID="txtGlobalFilterID"runat="server"Text='<%# Bind("GlobalFilterID") %>'Visible="False"></asp:TextBox><asp:LabelID="URL"runat="server"Text='<%# URINameLookup(cbyte(Eval("URITypeID"))) & HttpUtility.HtmlEncode(Convert.ToString(Eval("FilterURL"))) %>'></asp:Label></ItemTemplate><FooterTemplate><asp:DropDownListID="ddlFooterURIType"runat="server"AutoPostBack="True"DataSourceID="odsURITypes"DataTextField="URITypeName"DataValueField="URITypeID"></asp:DropDownList><asp:TextBoxID="txtURLAdd"runat="server"Width="75%"></asp:TextBox><ajaxToolkit:FilteredTextBoxExtenderID="ftxtURLAdd"runat="server"FilterType="Custom, Numbers, LowercaseLetters"TargetControlID="txtURLAdd"ValidChars="%_~-.*/"></ajaxToolkit:FilteredTextBoxExtender><asp:LinkButtonID="lnkAdd"runat="server"OnClick="lnkAdd_Click"SkinID="btnLinkFiltersAddGridFooter">Add</asp:LinkButton><%
-- <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="txtURLAdd"ErrorMessage="ItNotWorking" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>--
%></FooterTemplate><HeaderTemplate>URL
</HeaderTemplate><ItemStyleWidth="450px"/><HeaderStyleHorizontalAlign="Left"/></asp:TemplateField><asp:TemplateFieldHeaderText="Categorised"><EditItemTemplate></EditItemTemplate><ItemTemplate><%
-- <asp:Label ID="lblCategories" runat="server" Text='<%# LookupCS(URINameLookup(cByte(Eval("URITypeID"))) & HttpUtility.HtmlEncode(Convert.ToString(Eval("FilterURL"))))%>'></asp:Label>--%><asp:ImageID="Image1"runat="server"AlternateText='<%# LookupCS(URINameLookup(cByte(Eval("URITypeID"))) & HttpUtility.HtmlEncode(Convert.ToString(Eval("FilterURL")))) %>'SkinID="iconTick"ToolTip='<%# LookupCS(URINameLookup(cByte(Eval("URITypeID"))) & HttpUtility.HtmlEncode(Convert.ToString(Eval("FilterURL")))) %>'Visible='<%# IsCategorised(URINameLookup(cByte(Eval("URITypeID"))) & HttpUtility.HtmlEncode(Convert.ToString(Eval("FilterURL")))) %>'/></ItemTemplate><ItemStyleHorizontalAlign="Center"Width="70px"/><HeaderStyleHorizontalAlign="Center"/></asp:TemplateField></Columns><EmptyDataTemplate><tableborder="0"cellpadding="0"cellspacing="0"style="width: 650px;"><tr><!-- Edited to fix Error message AN (03/11/06) --><tdclass="tablecellbackground"><!-- <cc1:ErrorMessage ID="er1" runat="server" SkinID="99100" />-->Please Enter URL's
</td></tr><tr><tdclass="tablehead"><asp:DropDownListID="ddlEDTFooterURIType"runat="server"AutoPostBack="True"DataSourceID="odsURITypes"DataTextField="URITypeName"DataValueField="URITypeID"></asp:DropDownList><asp:TextBoxID="txtEDTURLAdd"runat="server"Width="75%"></asp:TextBox><asp:LinkButtonID="lnkEmptyGridAdd"runat="server"OnClick="lnkEmptyGridAdd_Click"SkinID="btnLinkFiltersAddGridFooter">Add</asp:LinkButton></td></tr></table><ajaxToolkit:FilteredTextBoxExtenderID="ftxtURLAdd"runat="server"FilterType="Custom, Numbers, LowercaseLetters"TargetControlID="txtEDTURLAdd"ValidChars="%_~-.*/"></ajaxToolkit:FilteredTextBoxExtender><!-- This is deliberatly here to load forsce script to load on empty data grid required --><asp:PanelID="DummyPopupMenu"runat="server"CssClass="popupMenu"><div></div></asp:Panel><asp:PanelID="DummygvwItemPanel"runat="server"Wrap="False"></asp:Panel></EmptyDataTemplate><PagerStyleHorizontalAlign="Center"/></asp:GridView><asp:ObjectDataSourceID="odsURITypes"runat="server"OldValuesParameterFormatString="original_{0}"SelectMethod="GetData"TypeName="dsFIB4TableAdapters.URITypeTableAdapter"></asp:ObjectDataSource><asp:ObjectDataSourceID="odsGlobalFilters"runat="server"DeleteMethod="Delete"InsertMethod="Add"SelectMethod="GetByFilterType"TypeName="GlobalFiltersBL"UpdateMethod="Update"><SelectParameters><asp:SessionParameterName="eFilterType"SessionField="FilterTypeID"Type="Object"/></SelectParameters><UpdateParameters><asp:ParameterName="GlobalFilterID"Type="Int32"/><asp:ParameterName="FilterTypeID"Type="Byte"/><asp:ParameterName="FilterURL"Type="String"/><asp:ParameterName="URITypeID"Type="Byte"/></UpdateParameters><InsertParameters><asp:ParameterName="URITypeID"Type="Byte"/><asp:ParameterName="FilterTypeID"Type="Byte"/><asp:ParameterName="FilterURL"Type="String"/></InsertParameters><DeleteParameters><asp:ParameterName="GlobalFilterID"Type="Int32"/></DeleteParameters></asp:ObjectDataSource></div><br/><br/><divstyle="margin-left: 10px"><asp:ImageButtonID="Save"runat="server"SkinID="btnSave"/> <asp:ImageButtonID="Cancel"runat="server"SkinID="btncancel"/></div></form></
body></
html>I do not see any frame references in the code - I use Iframes quite a bit - are you possibly using cross domains (meaning main page is one domain the iframe is in another) - as that is not supported.
Cursorary glance the code you present is for one or the other parent or child frame (will assume the child as usually the parent is just menus and what not)...
Can you actually paste the actual exception error you have?
Thanks for the reply jody.
yes jody there are two different sites running on my machine. User Portal and Admin Portal. User portal has menus and using Iframe when we click on Admin menu it displays the Admin portal in the Iframe. Does different domain mean two different sites setup in IIS or it means something else?
Execution Error comes when i type something in TextBox which is in Admin Portal Page displayed in IFrame. Its a client side error which says "Access is denied".
Unfortunately - it sounds like that is your issue. My understanding is that anything not matching the current domain will cause that. Not sure if the 'cross site limitation" applies to subdomains or not however as everything I do is wrapped around a single domain.
There is always using the main page and not having any ajax related controls and the Iframe reference all of the ajax. Unless there is a real need to have the main page ajaxified so to speak - not doing so - "should (but no experience with this - just thinking out loud)" should get rid of the cross script issue ...
If this is really imperative - you'd be pleased to know that the source code for ajax is now released and nothing would prevent you from modifying the code to change the behavior.
Hi Jody
I inspected it a little bit more. i debug the code where the error is coming up, it opens up ScriptResource.axd and the error its showing is on line
var offsetL = w.screenLeft - top.screenLeft - top.document.documentElement.scrollLeft + 2;
The line before this is :
var w= element.ownerDocument.parentWindow;
Can you make out why it is happening? Because i just use Ajax components and dont have much knowledge how they work.
Really appreciate your help mate.
thanks
I'll have to be honest with you - I really do not. I would assume that the ownerDocument is a determined by a method that checks 'domain' to make sure the parent frame and the child frame are related so to speak. Because it is returned as a null and nothing prevents the var w from being null - that the next executing line - errors because you can't subtract a a interger a null value...
So if it is really important - the ownerDocument would be the key to modifying the Ajax Source code...
Out of curiosity however, and for my own personal information is the cross domain issue due to subdomains or two seperate domains ?
They are two seperate sites in two different folders in IIS under Web Sites. But the server is same.
Then without changing the source for the core Ajax - there is nothing you can do as that will be considered cross domain scripting which for security reasons is prohibited with Ajax... Sorry - the only other thing you could do is migrate the code for portion of the other site into your application - either or not the solution you probably wanted to hear
Amit -
I had the same problem yesterday and posted here. This _appears_ to be a bug in the RTM but I haven't gotten confirmation of that yet. When you have an iframe which is not hosted at the same exact domain as the parent frame you will get this error from AJAX but all the AJAX controls continue to work just fine (which is why i call it a bug).
If you have control of both the parent frame and the child frame and they are just different subdomains, then you can put this javascript in BOTH pages referencing the top domain name (not the subdomain) and it will fix your problem:
<script type="text/javascript">
document.domain = 'mydomain.com';
</script>
If you don't have control of the parent frame (which was my problem) then you will have to actually go and modify the core AJAX javascript to modify that line you mention (and a few others). Unfortunately, because it is an embedded resource, you will have to replace the entire System.Web.Extensions assembly with your modified assembly. I spent half the day doing this, now that the source is released.
Lucky for you, I just posted a howto on my blog. It's not easy, nor is it straightforward. It looks like the source was released for reference and debugging only - it's not easy to compile and deploy modes. But hopefully my blog will help you out:
http://iterat.ive.ly/index.php/2007/01/31/build-your-own-modded-systemwebextensionsdll/
good luck
christopher
Hi Guys,
I'm running across the same problem. I was wonder if we can use the Copy the Javascript files from "C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\v1.0.61025\MicrosoftAjaxLibrary\System.Web.Extensions\1.0.61025.0" to our web project and use the scriptpath attribute from ScriptManager instead to use this instead.
Mike
I know in the RC versions that was supported. You could modify them and just instruct the scriptmanager to use that particular js file instead of the embedded resource. A search on the forums may pull up old posts on the exact technique...
Thanks Chris, Jody, Mike i am trying to work out the situation, lets see what i come up with but the best part i think is if i can specify the document.domain which makes it less tedious. so i will try it and let you all know how did i go.thanks once again.
Hi,
I just published a blog post that explains the issue and gives a workaround:
http://weblogs.asp.net/bleroy/archive/2007/01/31/how-to-work-around-the-quot-access-denied-quot-cross-domain-frame-issue-in-asp-net-ajax-1-0.aspx
Hope this helps
Bertrand
No comments:
Post a Comment