First off, this doesn't affect FF. So far, it only affects IE 8. I'm not sure why this is happening, but I wanted you to be aware.
SCENARIO:
I have a RadGrid with a PopUp edit form and a RadWindowManager on the page. The PopUp edit form has an anchor that, when clicked, executes a Javascript that opens the RadWindow. Currently the Javascript is in an external file, however, I've tried it in the external source file and in the .net form <head /> as well. Both deliver the same results.
ISSUE:
It works great the first time the anchor is clicked, however, after the RadWindow is closed, every time I click the link (whether its on the currently edited item or another), IE throws the Javascript error "The object does not support this property or method" on the line:
I tried both ways in opening the window:
And the incorrect way (removing the RadWindowManager and opening the window directly)
Both throw the same error. I've even put in a temporary "alert('hello');" command inside the function and, again, its displayed once, but every time afterwards, I get the exception. I have to reload the page in order to "find" the manageCategories function again.
Before I give you the fix, here's additional sample code snippets:
PopUp Form Template (notice the Javascript call at the end of line 9):
RadWindowManager:
FIX:
Again, the issue is, as far as I can tell, only in IE. The only way I could fix it was to change the code:
From:
To:
So, instead of calling another Javascript function, I'm calling the radopen method directly. This works in both FF and IE.
It seems that somehow IE is losing the manageCategories function after the radWindow has been opened and closed once.
Don't know, but hopefully this solution may help others and again, pinpoint a small bug?
Thanks guys.
Joshua
SCENARIO:
I have a RadGrid with a PopUp edit form and a RadWindowManager on the page. The PopUp edit form has an anchor that, when clicked, executes a Javascript that opens the RadWindow. Currently the Javascript is in an external file, however, I've tried it in the external source file and in the .net form <head /> as well. Both deliver the same results.
ISSUE:
It works great the first time the anchor is clicked, however, after the RadWindow is closed, every time I click the link (whether its on the currently edited item or another), IE throws the Javascript error "The object does not support this property or method" on the line:
| Sys.WebForms.PageRequestManager._initialize('ctl00$ScriptManager1', document.getElementById('aspnetForm')); |
I tried both ways in opening the window:
| function manageCategories() { |
| var oWnd = window.radopen("./ManageCategories.aspx", "manageCategories"); |
| } |
And the incorrect way (removing the RadWindowManager and opening the window directly)
| function manageCategories() { |
| var oWnd = $find(PageControls.manageCategories.id); |
| oWnd.setUrl("./ManageCategories.aspx"); |
| oWnd.show(); |
| } |
Both throw the same error. I've even put in a temporary "alert('hello');" command inside the function and, again, its displayed once, but every time afterwards, I get the exception. I have to reload the page in order to "find" the manageCategories function again.
Before I give you the fix, here's additional sample code snippets:
PopUp Form Template (notice the Javascript call at the end of line 9):
| <FormTemplate> |
| <table cellspacing="10" style="margin-left:10px;"> |
| <tr> |
| <td valign="top" align="right" style="width:100px;">Note: </td> |
| <td colspan="2"><asp:TextBox ID="tbNote" runat="server" TextMode="MultiLine" Rows="6" Columns="50" Text='<%# Bind("note") %>'></asp:TextBox></td> |
| </tr> |
| <tr> |
| <td valign="top" align="right" style="width:100px;">Category: </td> |
| <td><asp:DropDownList ID="ddlCategory" runat="server" SelectedValue='<%# Bind("categoryID") %>' AppendDataBoundItems="true" DataTextField="category" DataValueField="categoryID" DataSourceID="sqlCategories" ><asp:ListItem></asp:ListItem></asp:DropDownList> [<a onclick="javascript:manageCategories();">Manage Categories</a>]</td> |
| <td align="right"><asp:Button ID="btnUpdate" runat="server" Text='<%# (Container is GridEditFormInsertItem) ? "Add" : "Update" %>' Width="65" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>' /><asp:Button ID="btnCancel" runat="server" Text="Cancel" Width="65" CausesValidation="false" CommandName="Cancel" /></td> |
| </tr> |
| </table> |
| </FormTemplate> |
RadWindowManager:
| <telerik:RadWindowManager id="radWindowManager" runat="server"> |
| <windows> |
| <telerik:RadWindow id="manageCategories" Behaviors="Close" EnableEmbeddedSkins="false" Skin="Elevate" ReloadOnShow="true" |
| Left="250px" Modal="true" Runat="server" Width="275px" Height="300px" Title="Manage Categories" ClientCallBackFunction="categoriesCallback" VisibleStatusBar="false" IconUrl="/favicon.ico" > |
| </telerik:RadWindow> |
| </windows> |
| </telerik:RadWindowManager> |
FIX:
Again, the issue is, as far as I can tell, only in IE. The only way I could fix it was to change the code:
From:
| [<a onclick="javascript:manageCategories();">Manage Categories</a>] |
To:
| [<a onclick="javascript:window.radopen('./ManageCategories.aspx', 'manageCategories');">Manage Categories</a>] |
So, instead of calling another Javascript function, I'm calling the radopen method directly. This works in both FF and IE.
It seems that somehow IE is losing the manageCategories function after the radWindow has been opened and closed once.
Don't know, but hopefully this solution may help others and again, pinpoint a small bug?
Thanks guys.
Joshua