tailieunhanh - ASP.NET 2.0 Everyday Apps For Dumies 2006 phần 10
Tham khảo tài liệu ' everyday apps for dumies 2006 phần 10', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 11 Building a Blog Application 407 Building the Leave Comment Page The Leave Comment page lets a Web site visitor add a comment to a post. To see what this page looks like flip back to Figure 11-5. The following sections present the .aspx file and the code-behind files for this page. The page The .aspx file for the Leave Comment page is shown in Listing 11-10. This page displays the topic name in a FormView control at the top of the page. Then text boxes are used to get the user s name and comment. Listing 11-10 The page @ Page Language C 1 MasterPageFile AutoEventWireup true CodeFile Inherits Comment Title Blog-O-Rama asp Content ID Content1 Runat Server 2 ContentPlaceHolderID ContentPlaceHolder1 table border 0 width 700 3 tr td width 80 valign top Your name td td width 620 valign top asp TextBox ID txtName runat server 4 Width 400px td tr tr td width 80 valign top Your comment td td width 620 valign top asp TextBox ID txtComment runat server 5 TextMode MultiLine Height 200px Width 400px td tr table asp Button ID btnPost runat server 6 Text Post OnClick btnPost_Click continued 408 Part V Building Community Applications Listing 11-10 continued asp Button ID btnCancel runat server 7 Text Cancel OnClick btnCancel_Click asp SqlDataSource ID SqlDataSource1 8 runat server ConnectionString ConnectionStrings BlogConnectionString InsertCommand INSERT iNto Comments postid username comment VALUES @postid @username @comment InsertParameters asp QueryStringParameter Name postid 9 Type String QueryStringField postid asp ControlParameter Name username 10 Type String CốntrolID txtName PropertyName Text asp ControlParameter Name comment 11 Type String ControlID txtComment PropertyName Text InsertParameters asp SqlDataSource asp Content The critical lines of this listing are described in the following paragraphs 1 Don t forget to change the Language AutoEventWireup and CodeFile attributes in the Page directive if .
đang nạp các trang xem trước