最近遇到的一些小问题总结


一、火狐 谷歌  水平居中

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错误、重定向了。

猜你喜欢

转载自blog.csdn.net/xiongxyt2/article/details/8455194