SlideShare uma empresa Scribd logo
1 de 5
ASP.NET-Lab1-1
Trong bài này bạn sẽ thiết kế web, với một mẫu đăng ký thành viên đơn giản, gắn với
một số mã lệnh cơ bản bắt đầu cho việc thiết kế web của mình.
   1. Tạo mới một ứng dụng Web,




   2. Trong hộp thoại New Web Site, chọn ASP.NET Web Site, Đặt tên ứng dụng
      web là AspNetLab1 và lưu vào một thư mục chỉ định. Trong mục Location chọn
      File System, trong mục Language chọn Visual C#. Bấm nút OK.




   3. Xoá trang default.aspx ngầm định: bấm chuột phải lên trang default.aspx và
      chọn delete.
   4. Thêm mới một Web Form vào dự án: Bấm chuột phải lên dự án và chọn Add
      new item
Trên cửa sổ Add new item, trong danh sách Templates, ch ọn Web F orm. Trong
hộp Name nhập Registration.aspx, bấm chọn hộp kiểm Place code in separate file,
và bấm nút Add.




5. Đọc qua mã HTML sau đó Chuyển trang về chế độ thiết kế bằng cách bấm
   chọn Design phía dưới bên trái của cửa sổ.



6. Thiết kế trang đăng ký thành viên với các control được mô tả trong bản dưới đây:
     STT    Controls                   Thuộc tính và giá trị của thuộc tính
       1.   Panel                         - ID: panRegister
                                          - Width:400px
       2.   Table                         - Bạn có thể chèn bảng vào để thiết kế form thẳng
                                              hang, cột. Chèn Table vào trong Panel gồm 2
                                              hàng 2 cột. Bấm Insert trên thanh menu và chon
                                              Insert Table .Khi thêm một hang mới chỉ cần ấn
                                              phím Tab.
       3.   TextBox                       - ID: txtFirstName

       4.   TextBox                       -   ID : txtLastName

       5.   RadioButton                   -   ID : rdMale
                                          -   Text: Male
                                          -   GroupName: Sex
6.    RadioButton                   -   ID : rdFemale
                                              -   Text: Female
                                              -   GroupName: Sex
          7.    TextBox                       -   ID : txtEmail

          8.    TextBox                       -   ID : txtPhone

          9.    TextBox                       -   ID : txtUserName

          10.   TextBox                       -   ID : txtPassword
                                              -   TextMode: Password

          11.   Button                        -   ID : btnYes
                                              -   Text: Submit
          12.   Button                        -   ID : btnReset
                                              -   Text: Reset

Trang thiết kế của bạn sẽ tương tự như hình dưới đây




   7. Viết sự kiện cho nút Reset: bấm đúp vào nút Reset và viết mã lệnh hủy dữ liệu đã
      được nhập vào trong các điều khiển.
8. Viết sự kiện cho nút Submit

Bấm đúp vào nút submit để thực hiện viết lệnh
Chèn thêm namespace vào phần khai báo namespace trong trang code. Bằng cách nhập
dòng lệnh sau: using System.Text.RegularExpressions;

Viết mã lệnh cho sự kiện Click của nút Submit như sau:




Lưu ý: Bạn có thể copy chuỗi nguyên mẫu ở đây:
@"w+([-+.']w+)*@w+([-.]w+)*.w+([-.]w+)*"

   9. Thêm mới một Web Form vào dự án: Bấm chuột phải lên dự án và chọn Add
      new item. Đặt tên form là Welcome.aspx và bấm nút Add
10. Bấm chuột phải lên Welcome.aspx và chọn View Code, trang mã lệnh được mở
11. Trong sự kiện Page_Load thực hiện viết lệnh nhận dữ liệu từ trang
    Registration.aspx. Mã lệnh như dưới đây




12. Trên cửa sổ Solution Explorer bấm chuột phải lên trang Registration.aspx và
    chọn View in Browser.
13. Nhâp các thông tin cần thiết và bấm nút Submit
14. Kiểm tra kết quả.

Mais conteúdo relacionado

Destaque

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destaque (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Asp net lab1-1

  • 1. ASP.NET-Lab1-1 Trong bài này bạn sẽ thiết kế web, với một mẫu đăng ký thành viên đơn giản, gắn với một số mã lệnh cơ bản bắt đầu cho việc thiết kế web của mình. 1. Tạo mới một ứng dụng Web, 2. Trong hộp thoại New Web Site, chọn ASP.NET Web Site, Đặt tên ứng dụng web là AspNetLab1 và lưu vào một thư mục chỉ định. Trong mục Location chọn File System, trong mục Language chọn Visual C#. Bấm nút OK. 3. Xoá trang default.aspx ngầm định: bấm chuột phải lên trang default.aspx và chọn delete. 4. Thêm mới một Web Form vào dự án: Bấm chuột phải lên dự án và chọn Add new item
  • 2. Trên cửa sổ Add new item, trong danh sách Templates, ch ọn Web F orm. Trong hộp Name nhập Registration.aspx, bấm chọn hộp kiểm Place code in separate file, và bấm nút Add. 5. Đọc qua mã HTML sau đó Chuyển trang về chế độ thiết kế bằng cách bấm chọn Design phía dưới bên trái của cửa sổ. 6. Thiết kế trang đăng ký thành viên với các control được mô tả trong bản dưới đây: STT Controls Thuộc tính và giá trị của thuộc tính 1. Panel - ID: panRegister - Width:400px 2. Table - Bạn có thể chèn bảng vào để thiết kế form thẳng hang, cột. Chèn Table vào trong Panel gồm 2 hàng 2 cột. Bấm Insert trên thanh menu và chon Insert Table .Khi thêm một hang mới chỉ cần ấn phím Tab. 3. TextBox - ID: txtFirstName 4. TextBox - ID : txtLastName 5. RadioButton - ID : rdMale - Text: Male - GroupName: Sex
  • 3. 6. RadioButton - ID : rdFemale - Text: Female - GroupName: Sex 7. TextBox - ID : txtEmail 8. TextBox - ID : txtPhone 9. TextBox - ID : txtUserName 10. TextBox - ID : txtPassword - TextMode: Password 11. Button - ID : btnYes - Text: Submit 12. Button - ID : btnReset - Text: Reset Trang thiết kế của bạn sẽ tương tự như hình dưới đây 7. Viết sự kiện cho nút Reset: bấm đúp vào nút Reset và viết mã lệnh hủy dữ liệu đã được nhập vào trong các điều khiển.
  • 4. 8. Viết sự kiện cho nút Submit Bấm đúp vào nút submit để thực hiện viết lệnh Chèn thêm namespace vào phần khai báo namespace trong trang code. Bằng cách nhập dòng lệnh sau: using System.Text.RegularExpressions; Viết mã lệnh cho sự kiện Click của nút Submit như sau: Lưu ý: Bạn có thể copy chuỗi nguyên mẫu ở đây: @"w+([-+.']w+)*@w+([-.]w+)*.w+([-.]w+)*" 9. Thêm mới một Web Form vào dự án: Bấm chuột phải lên dự án và chọn Add new item. Đặt tên form là Welcome.aspx và bấm nút Add
  • 5. 10. Bấm chuột phải lên Welcome.aspx và chọn View Code, trang mã lệnh được mở 11. Trong sự kiện Page_Load thực hiện viết lệnh nhận dữ liệu từ trang Registration.aspx. Mã lệnh như dưới đây 12. Trên cửa sổ Solution Explorer bấm chuột phải lên trang Registration.aspx và chọn View in Browser. 13. Nhâp các thông tin cần thiết và bấm nút Submit 14. Kiểm tra kết quả.