admin管理员组文章数量:1379736
After the upgrade from dynamics-crm 2011 to dynamics-crm 2013 I am having some issues trying to refresh an iframe.
Previously and in the sdk Microsoft has to get a control/iframe use the "Xrm.Page.getControl()" or other posts say to use "Xrm.page.ui.controls.get()" below are the errors I am getting.
I have found a work around but my concern is that it is not supported. I use Jquery to first retrieve the iframe that is the record since it is no longer its own window. Then I search for the Name/Id of my web-resource/iframe.
$("#contentIFrame0").contents().find("#WebResource_PowerTools")[0].contentWindow.location.reload(true);
This works and is what I am using now. My question is does any one know what happened to the Xrm.Page.getControl()
or Xrm.page.ui.controls
?
After the upgrade from dynamics-crm 2011 to dynamics-crm 2013 I am having some issues trying to refresh an iframe.
Previously and in the sdk Microsoft has to get a control/iframe use the "Xrm.Page.getControl()" or other posts say to use "Xrm.page.ui.controls.get()" below are the errors I am getting.
I have found a work around but my concern is that it is not supported. I use Jquery to first retrieve the iframe that is the record since it is no longer its own window. Then I search for the Name/Id of my web-resource/iframe.
$("#contentIFrame0").contents().find("#WebResource_PowerTools")[0].contentWindow.location.reload(true);
This works and is what I am using now. My question is does any one know what happened to the Xrm.Page.getControl()
or Xrm.page.ui.controls
?
4 Answers
Reset to default 1In debugger there is a spelling mistake. It should be Xrm.Page.ui.controls
instead of Xrm.Page.ui.control
.
Below code should works for you.
Xrm.Page.ui.controls.get("WebResource_PowerTools");
The problem is you try to reach and use XRM in iFrame. But Xrm functions are in window, so just do it like this :
window.parent.Xrm.Page...
self.parent.Page.ui.controls.get("WebResource_PowerTools");
Xrm.Page.ui.controls.get('id_iframe').getObject().onload= function() {
var element = Xrm.Page.ui.controls.get('id_iframe').getObject().contentWindow.document.getElementById('id_element_inside_iframe');
console.log(element);
};
- Xrm.Page.ui.controls.get('id_iframe').getObject(): Returns the HTML object iFrame
本文标签: javascriptUnable to use XrmPagegetControl to get an iframeStack Overflow
版权声明:本文标题:javascript - Unable to use Xrm.Page.getControl to get an iframe - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744495396a2608992.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论