2008年9月3日 星期三

GRIDVIEW正確處理多行文字方框換行之查詢結果

//with template
((Label)e.Row.FindControl("LabelAfterCourseStatus")).Text = ((Label)e.Row.FindControl("LabelAfterCourseStatus")).Text.Replace("\r\n", "<br/>");

//without template
e.Row.Cells[1].Text=e.Row.Cells[1].Text.Replace("\\n", "<br/>");

PS. 請將<>改成小寫

Entity Framework 建立新物件並儲存後馬上取得關聯資料

使用 CreateProxy 建立物件,不要直接 new var newmodel = _contextXXX.CreateProxy<yyy>(); ... _contextXXX.yyy.Add(newmodel); await _contextXXX.SaveC...