瀏覽人數

            カウンター

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();

2012年6月28日 星期四

jquery.ajax 同步語法


  function isMember() {
       $.ajax({
       type:"POST",
       url: "<%= Url.Action("Action", "Controller") %>",
       data: "div=" + 1 + "&account=" + $("#Email").val(),
       dataType: "json",
       async:false,
       success: function(result){
       var status = result.Status;
       if(status == "Registered")
   {
      alert("您已是會員,請先登入");
location.href = ("<%=Url.Action("Login", "Member", new { id = "...?ReturnUrl=../../"}) %>");
}
}
       });
        }

2012年6月27日 星期三

下拉月日


var months=[1,2,3,4,5,6,7,8,9,10,11,12];
$.each(months, function(i, value){
var opts=$("<option></option>");
opts.val(value).text(value).appendTo("#BirthMonth");
});
$("<option></option>").val("").html("請選擇").appendTo("#BirthDate");


$("#BirthMonth").change(function(){
$("#BirthDate").empty();
var days=31;
var yearvalue=$.trim($("#BirthYear").val()) == "" ? new Date().getFullYear() : parseInt($("#BirthYear").val()) + 1911;
switch($(this).val()){
case "4":
case "6":
case "9":
case "11":
days=30;
break;
case "2":
days=(yearvalue%400==0 || (yearvalue%4==0 && yearvalue%100!=0)) ? 29 : 28; //29 days in bissextile February
break;
}
for(var i=1; i<=days; i++){
var opts=$("<option></option>");
opts.val(i).text(i).appendTo("#BirthDate");
}
});

sql 修改欄位型態


alter table Mobile_News
alter column [content] nvarchar(MAX);

2012年6月25日 星期一


focus fire
focus fire

JQuery 效果

小強!