2012年7月15日 星期日
jquery.ajax beforeSend的用法 馬上學
<div id="loading" style="display: none;position:fixed !important;position:absolute;top:0;left:0;height:100%; width:100%; z-index:999; background:#000 url(<%=Url.Content("~/images/load.gif")%>) no-repeat center center; opacity:0.6; filter:alpha(opacity=60);font-size:14px;line-height:20px;">
<p id="loading-one" style="color:#fff;position:absolute; top:50%; left:50%; margin:20px 0 0 -50px; padding:3px 10px;">資料載入中......</p></div>
<%-- 執行搜尋 --%>
$.ajax({
type: "POST",
url: '<%= Url.Action("xxx", "xxxx") %>',
data: formdata,
beforeSend: function () {
$("#loading").show();
},
success: function (data) {
$("#resultContainter").html(data);
$("#loading").hide();
$.scrollTo('0px',100);
},
error: function (data) {
alert("搜尋發生錯誤,請稍後再試..");
$("#loading").hide();
}
});
2012年7月11日 星期三
索取AD帳號的語法
using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;
public static string strLDAP = "LDAP://" + System.Configuration.ConfigurationManager.AppSettings["AD_HOST"] + "/OU=xxx,OU=xxx,dc=xxx,dc=xxx";
LogonName = UserPrincipal.Current.SamAccountName;
DirectoryEntry entry = null;
entry = new DirectoryEntry(strLDAP);
DirectorySearcher searcher = new DirectorySearcher(entry);
searcher.Filter = "(&(objectClass=User)(name=" + LogonName + "))";
searcher.PropertiesToLoad.AddRange(new string[] { "xx", "xxx", "xxxx", "xxxxx", "x" });
SearchResult result = searcher.FindOne();
ResultPropertyCollection propColl = result.Properties;
if (propColl["name"].Count > 0)
ViewData["name"] = propColl["name"][0].ToString();
if (propColl["department"].Count > 0)
ViewData["department"] = propColl["department"][0].ToString();
if (propColl["displayname"].Count > 0)
ViewData["displayname"] = propColl["displayname"][0].ToString();
訂閱:
文章 (Atom)