摘要:
if(!IsPost){ if(!Request.QueryString["ID"].IsEmpty()&&Request.QueryString["ID"].IsInt()){ // Etc.IsPostIsEmpty()IsInt() 阅读全文
摘要:
@grid.GetHtml( tableStyle: "grid", headerStyle: "head", alternatingRowStyle: "alt", columns: grid.Columns( grid.Column(format: @Edit), grid.Column("Title"), grid.Column("Genre"), grid.Column("Year") )) 可以对grid.Column设置Format grid.Column(for 阅读全文
摘要:
@{ Validation.RequireField("title", "You must enter a title"); Validation.RequireField("genre", "Genre is required"); Validation.RequireField("year", "You haven't entered a year"); var title = ""; var genre = ""; var 阅读全文
摘要:
@{ var db = Database.Open("WebPagesMovies") ; var selectCommand = "SELECT * FROM Movies"; var searchTerm = ""; if(!Request.QueryString["searchGenre"].IsEmpty() ) { selectCommand = "SELECT * FROM Movies WHERE Genre = @0"; searchTerm = Request.QueryStr 阅读全文
摘要:
var db =Database.Open("WebPagesMovies");var selectedData = db.Query("SELECT * FROM Movies");var grid =newWebGrid(source: selectedData);@{ var db=Database.Open("Empty Site"); var data=db.Query("select * from users"); var grid=new WebGrid(source:data); } ... 阅读全文
摘要:
@{ var world="hello world!"; if(IsPost) { world="posted"; } Response.Write(world); } @{ for (int i=1;i@i.ToString() } } IsPost form method 类型需要设置为 post 阅读全文
摘要:
@{ // Working with numbers var a = 4; var b = 5; var theSum = a + b; // Working with characters (strings) var technology = "ASP.NET"; var product ="Web Pages"; // Working with objects var rightNow = DateTime.Now;} Testing Razor Syntax Testing Razor Syntax The value of a is @a. Th 阅读全文
摘要:
@{ var world="hello world!"; Response.Write(world);} @{ for (int i=1;i@i.ToString() } } 1.HTML 中使用C# 语句,代码块使用 @{} 2.@{}可以夹杂 html 语句3.html可以夹杂 @var 这样的变量 阅读全文