How to open HTML web resource in modal dialog

一曲冷凌霜 提交于 2019-12-11 14:29:50

问题


I created some HTML web resource. How can I open it in modal dialog after clicking on some ribbon button?

Thanks!


回答1:


I would suggest to use http://crmvisualribbonedit.codeplex.com/ to edit your ribbon. On your button, set the action to url and link to your webresource. In the win mode setting choose Model Dialog.

This is what I have in the address field on the action:

http://server/organization/WebResources/new_htmlpage

new_htmlpage is the name of the webresource.

Here is the CommandDefinitions part of ribbondiff

<CommandDefinitions>
  <CommandDefinition Id="new.Form.account.MainTab.ExportData.modalPopup.Command">
    <EnableRules />
    <DisplayRules />
    <Actions>
      <Url WinMode="1" Address="http://server/organization/WebResources/new_htmlpage" PassParams="false" />
    </Actions>
  </CommandDefinition>
</CommandDefinitions>



回答2:


In the address you should have $webresource:new_htmlpage

This way you have a relative link to the web resource!




回答3:


Don't know about CRM 2011 but in 2015 better not use Url Action to open Html Web Resources, MSDN:

Don’t use this action(Url Action) to open entity forms or web resources. Use the (RibbonDiffXml) with a function that uses Xrm.Utility.openEntityForm or Xrm.Utility.openWebResource instead.

Also with Url Action you can't simply send query string parameters to Html Web Resource and parameters must be encoded in "data" query string parameter.

var customParameters = encodeURIComponent("first=First Value&second=SecondValue&third=Third Value");
Xrm.Utility.openWebResource("new_webResource.htm",customParameters);

MSDN:
Xrm.Utility (client-side reference)



来源:https://stackoverflow.com/questions/14380281/how-to-open-html-web-resource-in-modal-dialog

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!