目前日期文章:201710 (4)

瀏覽方式: 標題列表 簡短摘要

1.查看目前connection

sp_who 

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

1.div 靠右對齊:

<div class="pull-right">

2.input type=text 之後的文字水平對齊:

<div class="help-block">

3.與標題 label對齊的純文字:

<p class="form-control-static"></p>

4.readonly 增加自定義class:uneditable,讓其使用純文字方式顯示資料,但仍為一個表單的欄位資料

<input type="text" class="form-control uneditable" readonly>

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

 

1.[IQueryable]order by two or more properties

OrderBy(i => i.PropertyName).ThenBy(i => i.AnotherProperty)

2.OrderBy list for only Date but not Time 

error:The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.

rderBy(i => EntityFunctions.TruncateTime(i.CreateDate))

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

1.Concatenating strings

@(Model.address + " " + Model.city)

or

@(String.Format("{0} {1}", Model.address, Model.city))

With C# 6

@($"{Model.address} {Model.city}")

 

2.date to string
(1)Published若為not nullable
@item.Published.ToString("yyyy-MM-dd")

(2)Published若為nullable

@item.Published.Value.ToString("yyyy-MM-dd")

3.check string null/empty

@if (Model != null && !String.IsNullOrEmpty(Model.ImageName))
{
    <label for="Image">Change picture</label>
}

4.prevent escaping html in Razor

Html.Raw(Model.Content)

 

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