Friday, March 31, 2017

How to configure a WCF service running like Rest Service?

I have various posts on the configure of WCF. i will show you another configure if you want your WCF service to call with rest service call like

http://WCFHostServer/myWCF.svc/YourMethod

Note to be taken:

1. must use the webHttpBinding.
2. enable HttpsGet in service behaviors setting
3. add <webHttp> to endpoint behavior setting.

here is WCF configuration in my sample wcf application

  <system.serviceModel>
    <services>
      <service name="MyWCF"
               behaviorConfiguration="MyWCF.Service1Behavior">
        <endpoint address="" binding="webHttpBinding" behaviorConfiguration="EndPointBehavior"
                  contract="MyWCF.IMyWCF"
                    bindingConfiguration="wbBind">
          </endpoint>
          </service>
        </services>
    <behaviors>
      <serviceBehaviors>
        <behavior name="MyWCF.Service1Behavior">
          <serviceMetadata httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <serviceCredentials>
            <windowsAuthentication allowAnonymousLogons="False" includeWindowsGroups="True"/>
          </serviceCredentials>
          </behavior>
        </serviceBehaviors>
      <endpointBehaviors>
        <behavior name="EndPointBehavior">
          <webHttp />
        </behavior>
      </endpointBehaviors>
    </behaviors>
    <bindings>
      <webHttpBinding>
        <binding name="wbBind">
          <security mode="Transport">
            <transport clientCredentialType="Windows" proxyCredentialType="Windows"/>
            </security>
            </binding>
          </webHttpBinding>
    </bindings>
  </system.serviceModel>

How to add an event handle to dynamic generated HTML content?

when we have a static web content, we can add an javascript function to the element on Doccument.ready Event.

<table><tr id="myRow"><td></td></tr><table>

in  $(document).ready(function () {
    $("myRow").onClick(function(event){
        var $this = $(this);
        var tbody= $(this).closest('tbody').next('tbody');
        if (tbody.hasClass("collapsed")) {
            var img=$this.find('.expandImg');
            $this.find('.expandImg').attr("src","/_layouts/images/minus.gif");
            tbody.removeClass("collapsed");
        } else {
            tbody.addClass("collapsed");
            $this.find('.expandImg').attr("src","/_layouts/images/plus.gif");
        }
}

However, if the html content is created in the fly. then click event no longer work,
we should use the .live() instead of onClick
$(".myRow").live('click', function(event){
        var $this = $(this);
        var tbody= $(this).closest('tbody').next('tbody');
        if (tbody.hasClass("collapsed")) {
            var img=$this.find('.expandImg');
            $this.find('.expandImg').attr("src","/_layouts/images/minus.gif");
            tbody.removeClass("collapsed");
        } else {
            tbody.addClass("collapsed");
            $this.find('.expandImg').attr("src","/_layouts/images/plus.gif");
        }

Tuesday, March 21, 2017

How to use the css file in the Nintex Form to customize the layout

it is quick convenient if we can have a css file to control the layout of the Nintex form, This approach will allow us to modify the change in the css file to fix all layout isse in the nintex. we did not have to open all the forms one by one and modify the css in the Custom CSS Section in the Form Setting Window




Actually we can use the Custom CSS Includes Section to add a link reference pointing to the path of the css file



we only have to refresh the page to get the change in affect. in my case, i put my css stylesheet under the style library in the same sharepoint site

Site URL/Style%20Library/CSS/AdminAccessControlForm.css