一、火狐 谷歌 水平居中
1、要有document的標題
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
<html xmlns="http://www.w3.org/1999/xhtml" >
2、父級容器要定寬度、text-aling、 margin 0 auto
.newsletter_column1{ width:166px; min-height:150px; float:left; margin-right:40px; margin-bottom:20px;text-align:center;}
.newsletter_column1 span {text-align:center;margin:5px auto; font-weight:bold;}
二、Sys.WebForms.PageRequestManagerServerErrorException An unknown error occurred while processing the request on the server. The status code returned from the server was 500
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="false"/>
在配置文件<system.web>下面添加
<httpRuntime requestValidationMode="2.0" maxRequestLength="8192" />
三、查看EF生成的Sql
using(var ctx = new TestDBEntities)
{
var query = ctx.Clients.Where(c => c.Status == 1)
.OrderBy(c => c.ComputerName);
//調試輸出SQL,注意query不能ToList(),否則就不是IQueryable了
Debug.WriteLine((query as ObjectQuery).ToTraceString());
//後續業務邏輯處理數據
foreach(var client in query)
{
//......
}
}
四、HyperLinkField多參數
<asp:HyperLinkField Text="查看" DataNavigateUrlFormatString="AuditQuestion_Edit.aspx?sid={0}&;staskid={1}&cmd=Look" DataNavigateUrlFields="sid,staskid"></asp:HyperLinkField>
五、給某個Action添加特定的路由規則
context.MapRoute(
"test", // 路由名稱
"Wap/{controller}/{action}/{uID}/{BarCode}/{id}", // 帶有參數的 URL
new { controller = "Home1", action = "ScanResult" } // 參數默認值
);
public ActionResult ScanResult(int uID, string BarCode,int id=22 )
六、GridView 的數據源沒有任何可用來生成列的屬性或特性
給GridView綁定的數據源是List<T>
當T中的屬性沒有get set時就會報這個錯
只要加上get set即可
七、iis7 httplocalhostiisstart.htm或http127.0.0.1iisstart.htm打開是空白頁
控制面板--程序和功能---打開或關閉Windows功能--Internet信息服務->萬維網服務->常見HTTP功能,少選了HTTP錯誤、重定向了。