目前为止用winform做CS的内容比较多,个人觉得BS是以后的趋势,还是得学学。
先说学习过程吧,下了本 ASP.NET程序设计教程与实训(C#语言版) 方明清 易永红,07年出的,对着的是asp.net2.0,我用vs2010做例子,发现怎么都对不着,又问同事找了本ASP.NET本编程第三版,也是ASP.NETT2.0,好吧,我屈服了,用VS2008,起码对着了。
下面是第一个程序的aspx的html:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %> <!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" > <head runat="server"> <title>无标题页</title> </head> <body> <p> Hello World !</p> <form id="form1" runat="server"> <div style="height: 331px"> <h1>CheckBoxList</h1> <h2>Adding ListItems</h2> <asp:CheckBoxList ID="cblItems" runat="server"> <asp:ListItem>item1</asp:ListItem> <asp:ListItem>item2</asp:ListItem> </asp:CheckBoxList> </div> </form> </body> </html>
很简单,就是放个checkboxlist,往上面再加几个item,因为用winform,习惯性拖控件,额,拖不上去,手动写,写好,编译成功,但是点到aspx的设计界面出现下面错误:
查查,应该是路径中不能出现 “#”字符,没见过这么奇葩的,好吧姐服了,换个路径存工程,好了,控件也能直接拖上去了
这门真不好敲!!!!!