Summary of some small problems encountered recently


1. Firefox Google is centered

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" />


Three, view the Sql generated by EF

using(var ctx = new TestDBEntities) 

    var query = ctx.Clients.Where(c => c.Status == 1) 
                .OrderBy(c => c.ComputerName); 
 
    //Debug output SQL, note that query cannot be ToList( ), otherwise it is not IQueryable. 
    Debug.WriteLine((query as ObjectQuery). ToTraceString() ); 
 
    //Follow-up business logic processing data 
    foreach(var client in query) 
    { 
        //... 
    } 



Fourth, HyperLinkField Multi-parameter

<asp:HyperLinkField Text="查看" DataNavigateUrlFormatString="AuditQuestion_Edit.aspx?sid={0}&;staskid={1}&cmd=Look" DataNavigateUrlFields="sid,staskid"></asp:HyperLinkField>


Five, add specific routing rules to an Action

 context.MapRoute(
               "test", // Route name
               "Wap/{controller}/{action}/{uID}/{BarCode}/{id}", // URL with parameters
               new {controller = "Home1" , action = "ScanResult"} // parameter default value
           );


 public ActionResult ScanResult(int uID, string BarCode,int id=22)


6. The GridView data source does not have any attributes or characteristics that can be used to generate columns

The data source bound to the GridView is List<T>
. This error will be reported when the property in T does not have a get set.
Just add get set.


Seven, iis7 httplocalhostiisstart.htm or http127.0.0.1iisstart.htm open is a blank page  

Control Panel-Programs and Features-Turn Windows features on or off-Internet Information Services -> World Wide Web Services -> Common HTTP functions. HTTP errors and redirection are less selected.

Guess you like

Origin blog.csdn.net/xiongxyt2/article/details/8455194