总结:SharePoint Designer 2010 DVWP (4) -- DataFormWebPart -- Parameter, QueryString, JQuery

 

首先选中DataFormWebPart,然后点击Ribbon上的“Parameters”, 新建一个Parameter,选择“Parameter Source”为“Query String”,设置“Query String Variable”和“Default Value”,URL类似于:http://localhost/pPages/TestListGroupView.aspx?SiteCollection=Control

如果想用JQuery得到URL中的参数,可以用以下方法:

    <script language="javascript" type="text/javascript">

        function queryString(parameter) {

          var loc = location.search.substring(1, location.search.length);

          var param_value = false;

 

          var params = loc.split(“&”);

          for (i=0; i<params.length;i++) {

              param_name = params[i].substring(0,params[i].indexOf(‘=’));

              if (param_name == parameter) {

                  param_value = params[i].substring(params[i].indexOf(‘=’)+1)

              }

          }

          if (param_value) {

             return param_value;

          }

          else {

              return false; //Here determine return if no parameter is found

          }

        }

    </script>

 

Help Links

http://www.sieena.com/blog/archive/2010/12/03/setting-query-string-values-on-sharepoint-forms-using-xslt-and-javascript.aspx

http://sharepoint.jai-world.com/archives/71

http://www.sharepointboris.net/2007/07/querystring-get-parameters-from-url-with-javascript/

 

你可能感兴趣的:(SharePoint)