How to open HTML web resource in modal dialog

2019-07-30 01:52发布

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

Thanks!

3条回答
疯言疯语
2楼-- · 2019-07-30 02:10

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>
查看更多
叼着烟拽天下
3楼-- · 2019-07-30 02:12

In the address you should have $webresource:new_htmlpage

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

查看更多
姐就是有狂的资本
4楼-- · 2019-07-30 02:13

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)

查看更多
登录 后发表回答