目前分類:ASP.NET C# (136)

瀏覽方式: 標題列表 簡短摘要
enum Colors { None=0, Red = 1, Green = 2, Blue = 4 };
 string[] colorStrings = { "0", "2", "8", "blue", "Blue", "Yellow", "Red, Green" };

Colors colorValue = (Colors) Enum.Parse(typeof(Colors), colorString);

amychang2014 發表在 痞客邦 留言(0) 人氣()

注意jQuery內傳的參數名稱和WebService的參數名稱要一致!

 

The Other Reason

  1. Not using JSON.stringify to pass parameter value.
  2. If you not supply type in jQuery, it will use GET method which is not accept in your webservice configuration. Add  ( type : "POST ) in your jQuery code to use POST method.
  3. You are actually request data from different domain. Cross Domain Request (CORS)which is not allowed. Please read here
  4. Content type not supply or not correct. Use "application/json; charset=utf-8"
  5. DataType not not supply or not correct. Use json or jsonp

 

amychang2014 發表在 痞客邦 留言(0) 人氣()

void Application_BeginRequest(object sender, EventArgs e)
{
    HttpApplication app = sender as HttpApplication;
    if(app.Request.Path.IndexOf("FriendlyPage.html") > 0)
    {
        app.Context.RewritePath("/UnfriendlyPage.aspx?SomeQuery=12345");
    }
}

amychang2014 發表在 痞客邦 留言(0) 人氣()

Response.Redirect("http://www.flashwolves.com" + HttpContext.Current.Request.Url.PathAndQuery);

 

amychang2014 發表在 痞客邦 留言(0) 人氣()

DataSet 廠商專頁ds = DBstatic.廠商專頁ds;

DataRow[] updateRow = 廠商專頁ds.Tables[0].Select("專頁編號 = '" + 專頁編號 + "'");

amychang2014 發表在 痞客邦 留言(0) 人氣()

用途:在codebehind寫txterrmsg.Text = "..."; 就會有即時的alert彈出來!
要放在$(function(){})裡用唷!

setInterval(function () {
    var err = $('#<%=txterrmsg.ClientID%>').val();
    if (err != '') {
        myalert(err);
        $('#<%=txterrmsg.ClientID%>').val('');
        hidenowpop();
    }
    var topoffset = 0;
    if (detectDevice()) {
        topoffset = 0;
    } else
        topoffset = 60;
    $('#pop').css('top', topoffset + parseInt($('body').scrollTop()) + 'px');
}, 200);

amychang2014 發表在 痞客邦 留言(0) 人氣()

DateTime 開始時間 = DateTime.ParseExact(終止區間[0], "yyyy/MM/dd", System.Globalization.CultureInfo.InvariantCulture);
DateTime 結束時間 = DateTime.ParseExact(終止區間[1], "yyyy/MM/dd", System.Globalization.CultureInfo.InvariantCulture);
if (今天.Date < 開始時間.Date || 今天.Date > 結束時間.Date)
{
        Response.Redirect("../expiry/" + Page.RouteData.Values["name"]);
}

amychang2014 發表在 痞客邦 留言(0) 人氣()

using System.Text.RegularExpressions;

string saveFile = FileUpload1.Value;
saveFile = Regex.Replace(saveFile, @"\s+", ""); //清除空白字元

amychang2014 發表在 痞客邦 留言(0) 人氣()


$(document).on('change','.browseimage',function(){
    alert('change');// check FormData and ajax ..});


amychang2014 發表在 痞客邦 留言(0) 人氣()

取出方式
Page.RouteData.Values["name"].ToString();

amychang2014 發表在 痞客邦 留言(0) 人氣()

public int 資料重撈時間 = 5;  //分鐘
public static DateTime DB資料暫存時間 = new DateTime();


DateTime dt1 = DBstatic.DB資料暫存時間;
DateTime dt2 = DateTime.Now;
TimeSpan dt3 = dt2.Subtract(dt1);
int timeoffset = (int)dt3.TotalMinutes;
if (timeoffset > 資料重撈時間)    //unicorn
{
    募款單位ds = DBstatic.募款單位();
}

amychang2014 發表在 痞客邦 留言(0) 人氣()

string[] birthday = ds.Tables[0].Rows[i]["選手生日"].ToString().Split('-');
DateTime today = DateTime.Today; DateTime bday = new DateTime(Convert.ToInt16(birthday[0]), Convert.ToInt16(birthday[1]), Convert.ToInt16(birthday[2])); int age = today.Year - bday.Year; if (bday > today.AddYears(-age)) age--;

amychang2014 發表在 痞客邦 留言(0) 人氣()

<object type="application/x-shockwave-flash" height="378" width="620" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=jackcombat" bgcolor="#000000"><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><param name="allowNetworking" value="all"/><param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf"/><param name="flashvars" value="hostname=www.twitch.tv&channel=jackcombat&auto_play=false"/></object>

 

amychang2014 發表在 痞客邦 留言(0) 人氣()

【HTML】

<input type="hidden" id="相簿_temp" class="相簿_temp" runat="server">

amychang2014 發表在 痞客邦 留言(0) 人氣()

http://blogs.microsoft.co.il/tamirs/2009/03/16/pageload-event-fires-twice/

http://stackoverflow.com/questions/2009092/page-loads-twice-in-google-chrome

amychang2014 發表在 痞客邦 留言(0) 人氣()

http://demo.tc/post/95

 

amychang2014 發表在 痞客邦 留言(0) 人氣()

http://www.newtonsoft.com/json/help/html/SerializeDataSet.htm

 

amychang2014 發表在 痞客邦 留言(0) 人氣()

//裁圖工具

http://tympanus.net/codrops/2014/10/30/resizing-cropping-images-canvas/

amychang2014 發表在 痞客邦 留言(0) 人氣()

public partial class MasterPage : MasterBase
{
    int pushid = 0;   //照順序排才不會亂掉

AddheadControl(headertype.css, "~/css/master.css", pushid++);
AddheadControl(headertype.css, "~/css/btn.css", pushid++);
AddheadControl(headertype.js, "~/js/jquery-1.9.1.min.js", pushid++);
AddheadControl(headertype.js, "~/myJS/cherryblockV2-min.js", pushid++);
AddheadControl(headertype.js, "~/myJS/illya.js", pushid++);
AddheadControl(headertype.js, "~/myJS/AjaxHandler.js?140522", pushid++);
AddheadControl(headertype.js, "~/myJS/base.js?140929", pushid++);
AddheadControl(headertype.js, "~/myJS/msChkboxKai.js", pushid++);
AddheadControl(headertype.js, "~/myJS/oebigfire-min.js", pushid++);

amychang2014 發表在 痞客邦 留言(0) 人氣()

DataTable dt = ds.Tables[0];
RP_leftnews.DataSource = dt;
RP_leftnews.DataBind();

<asp:Repeater ID="RP_leftnews" runat="server">
    <ItemTemplate>
        <ul class="newList">
            <li><a href="<%#Eval("link") %>"><img alt="" src="<%#Eval("pic") %>" /></a></li>
            <li style="width:73%">
                <p class="newsTitle"><a href="<%#Eval("link") %>"><%#Eval("lefttitle") %></a></p>
                <p class="newsRightdate" style="padding-bottom: 6px;"><%#Eval("date") %></p>
                <p class="newsContent"><%#Eval("leftcontent") %>....</p>
            </li>
        </ul>                       
    </ItemTemplate>
</asp:Repeater>

amychang2014 發表在 痞客邦 留言(0) 人氣()