ImageVerifierCode 换一换
格式:DOC , 页数:9 ,大小:66KB ,
资源ID:7672941      下载积分:10 金币
快捷注册下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

开通VIP
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.zixin.com.cn/docdown/7672941.html】到电脑端继续下载(重复下载【60天内】不扣币)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

开通VIP折扣优惠下载文档

            查看会员权益                  [ 下载后找不到文档?]

填表反馈(24小时):  下载求助     关注领币    退款申请

开具发票请登录PC端进行申请

   平台协调中心        【在线客服】        免费申请共赢上传

权利声明

1、咨信平台为文档C2C交易模式,即用户上传的文档直接被用户下载,收益归上传人(含作者)所有;本站仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。所展示的作品文档包括内容和图片全部来源于网络用户和作者上传投稿,我们不确定上传用户享有完全著作权,根据《信息网络传播权保护条例》,如果侵犯了您的版权、权益或隐私,请联系我们,核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
2、文档的总页数、文档格式和文档大小以系统显示为准(内容中显示的页数不一定正确),网站客服只以系统显示的页数、文件格式、文档大小作为仲裁依据,个别因单元格分列造成显示页码不一将协商解决,平台无法对文档的真实性、完整性、权威性、准确性、专业性及其观点立场做任何保证或承诺,下载前须认真查看,确认无误后再购买,务必慎重购买;若有违法违纪将进行移交司法处理,若涉侵权平台将进行基本处罚并下架。
3、本站所有内容均由用户上传,付费前请自行鉴别,如您付费,意味着您已接受本站规则且自行承担风险,本站不进行额外附加服务,虚拟产品一经售出概不退款(未进行购买下载可退充值款),文档一经付费(服务费)、不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
4、如你看到网页展示的文档有www.zixin.com.cn水印,是因预览和防盗链等技术需要对页面进行转换压缩成图而已,我们并不对上传的文档进行任何编辑或修改,文档下载后都不会有水印标识(原文档上传前个别存留的除外),下载后原文更清晰;试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓;PPT和DOC文档可被视为“模板”,允许上传人保留章节、目录结构的情况下删减部份的内容;PDF文档不管是原文档转换或图片扫描而得,本站不作要求视为允许,下载前可先查看【教您几个在下载文档中可以更好的避免被坑】。
5、本文档所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用;网站提供的党政主题相关内容(国旗、国徽、党徽--等)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
6、文档遇到问题,请及时联系平台进行协调解决,联系【微信客服】、【QQ客服】,若有其他问题请点击或扫码反馈【服务填表】;文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“【版权申诉】”,意见反馈和侵权处理邮箱:1219186828@qq.com;也可以拔打客服电话:0574-28810668;投诉电话:18658249818。

注意事项

本文(C#LabC#WebForms.doc)为本站上传会员【xrp****65】主动上传,咨信网仅是提供信息存储空间和展示预览,仅对用户上传内容的表现方式做保护处理,对上载内容不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知咨信网(发送邮件至1219186828@qq.com、拔打电话4009-655-100或【 微信客服】、【 QQ客服】),核实后会尽快下架及时删除,并可随时和客服了解处理情况,尊重保护知识产权我们共同努力。
温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载【60天内】不扣币。 服务填表

C#LabC#WebForms.doc

1、C# Lab: C# Web Forms C# Lab: Creating Dynamic Web UI Using Web Forms C# is built from the ground up to create scalable, dynamic applications for the Microsoft® .NET® platform. For the pages that make up the user interface of a dynamic Web application C# brings Visual Basic-like WYSIWYG design and

2、 coding techniques to the Web. Imagine this: you drag a button from the toolbox and drop it on a form. Double-click the button and your view switches to the code view with your cursor already positioned in the appropriate event handler. As you type, IntelliSense statement completion helps you

3、create error-free code, fast. Sound easy? It is, and you’ve just created a form for the Web. In this lab, you will use the Web Forms designer in Visual Studio.NET to create dynamic, scalable, browser-independent UI for a Web application using the C# programming language. Note: There are addi

4、tional Web Forms exercises in the Data and Debugger labs. Objectives After completing this lab, you will be able to: ü Use C# to create dynamic Web pages based on the ASP+ Web Forms technology ü Add input validation to Web Form fields that executes on both the client and the server without writi

5、ng any code Before You Begin Prerequisites This lab assumes that you have a computer running Windows 2000 and the Microsoft Visual Studio.NET Beta1 development system. Background Web Forms Support in Visual Studio.NET One of the key benefits of the Web Forms framework over ASP is a clean s

6、eparation of code from the declarative HTML and XML tags that define the visible elements of a page. Visual Studio.NET separates these two components in a .CS file, which contains the logic for the page, and an ASPX file, which contains the HTML and XML tags. When you open the ASPX file in Visual

7、Studio, the file is displayed using the Web Forms designer. This designer presents two views of the ASPX file. The Design View lets you edit the visual elements of the form using the familiar drag, drop and click techniques used in Visual Basic programming. HTML View permits you to directly manip

8、ulate the declarative HTML and XML tags. You can switch between views by clicking the Design and HTML buttons at the bottom of the page. When you open the .CS file (or double-click a control in Design View) this file is opened using the C# code editor. You get the full power of the C# programmin

9、g language plus all of the features of the Visual Studio.NET C# code editor including color-coding, design-time syntax checking and IntelliSense statement completion. Figure 1. WebForm files in Solution Explorer Input Validation Validation controls are added to a Web Form like other server c

10、ontrols. There are controls for specific types of validation, such as range checking or pattern matching, plus a RequiredFieldValidator that ensures a user does not skip an entry field. You can attach more than one validation control to an input control. For example, you might specify that an entry

11、is both required and that it contain a specific range of values. There are validation controls for specific types of validation, such as range checking or pattern matching. This is the complete list: Control Name Description RequiredFieldValidator Ensures that the user does not skip an entry.

12、 CompareValidator Compares a user's entry against a constant value or a property value of another control using a comparison operator (less than, equal, greater than, and so on). RangeValidator Checks that a user's entry is between specified lower and upper boundaries. You can check ranges withi

13、n pairs of numbers, alphabetic characters, and dates. Boundaries can be expressed as constants or as values derived from another control. RegularExpressionValidator Checks that the entry matches a pattern defined by a regular expression. This type of validation allows you to check for predictable

14、sequences of characters, such as those in social security numbers, e-mail addresses, telephone numbers, postal codes, and so on. CustomValidator Checks the user's entry using validation logic that you code yourself. This type of validation allows you to check for values derived at run time. Valid

15、ationSummary Displays the validation errors in summary form for all of the validators on a page. Since the validation controls can display error text, they are typically placed where you want the error text to display. Then the controls are hooked up to an input control (like a TextBox or DropD

16、ownList) simply by setting a few properties. The Web Forms framework takes care of the processing the input validation. Validation occurs on the server for all browsers and can optionally occur on the client for certain browsers. Note: For the Technology PreRelease, client-side validation is su

17、pported for Internet Explorer 5 and later only. Validation controls work with a limited subset of input controls. For each control, a specific property contains the value to be validated. Here are the input controls that may be validated: Control Validation Property HtmlInputText Value HtmlTe

18、xtArea Value HtmlSelect Value HtmlInputFile Value TextBox Text ListBox SelectedItem DropDownList SelectedItem RadioButtonList SelectedItem Exercises The following exercises will allow you to become familiar with the concepts and techniques covered in this lab: Exercise 1: Create a

19、Web Form in Design View In this exercise, you will use the Design View of the Web Forms designer to create Web Forms using classical Visual Basic-like drag, drop and click techniques. Exercise 2: Working in HTML Mode In this exercise, you will explore the additional features that enable you to

20、directly manipulate the HTML and XML tags that make up the visual elements of a Web Form. Exercise 3: Input Validation In this exercise, you will add input validation to a form using extremely easy RAD techniques – no code required. For invalid values, your form will give the user immediate feed

21、back that she can use to correct her input before submitting the form to the Web server. Exercise 1: Design a Basic Web Form In this exercise, you will use the Design View of the Web Forms designer to create Web Forms using classical Visual Basic-like drag, drop and click techniques. º Estimate

22、d time to complete this lab: 15 minutes. þ Create a new Web Application 1. Start Visual Studio.NET. 2. From the File Menu, choose New then Project. 3. In the New Project Dialog, select C# Projects in the left hand list. 4. Select Web Application in the right-hand list. 5. For Name, type WebApp

23、lication1 6. For Location, type http://localhost 7. Click OK. C# creates and opens a new application. The startup form for the project – WebForm1.aspx – is open in the designer. þ Change the form’s TargetSchema property to HTML 4.0. For this form, we’ll target features supported only in HTML

24、4.0 and higher, like in-line style properties. 1. Click any blank part of the form to select it. 2. Find the Properties Window. 3. From the dropdown list at the top of this window, select DOCUMENT. 4. Set TargetSchema to HTML 4.0 þ Set the background color of the form 1. Make sure DOCUMENT

25、is still selected in the Properties window 2. Set bgcolor to any light color. þ Add some static text Many forms contain static text. In the Web Forms designer you add text as if you were typing in a word processor like Word. 1. At the top of the form, type: Select a date 2. Press Enter three t

26、imes. 3. Type: You selected: 4. Press Enter once more. þ Change the text properties 1. Highlight all of the text 2. Using the buttons in the toolbar, set the font face to Verdana 3. Set the font size to 4. 4. Using the buttons in the toolbar, set the font color to any dark color. þ Add a C

27、alendar control to the form 1. Verify that the Web Forms tab is selected in the toolbox. 2. Drag a Calendar control to the one of the blank lines between the two lines of text. (You may need to switch the PageLayout property of the Document to GridLayout to move the control). þ Change the ID prop

28、erty of the Calendar to myCal 1. Make sure the Calendar control is selected. 2. Using the Properties window, set ID to myCal. þ AutoFormat the Calendar 1. Click the AutoFormat command link in the property grid (in the Properties window, under the Properties listed for myCal). 2. Select a format

29、 3. Click OK. þ Add a Label to the page You’ll set the contents of this label from your code. 1. Verify that the Web Forms tab is selected in the toolbox. 2. Drag a Label control to the blank line beneath the text "You selected:" þ Change the ID property of the Label to myLabel 1. Make sure

30、the Label control is selected. 2. Using the Properties window, set ID to myLabel. þ Double-click the Calendar This will generate a stub event handler for the Calendar’s default event, "SelectionChanged." 1. Double-click the Calendar. þ Add some code to the myCal_SelectionChanged event handler

31、1. Within the event handler routine, enter: myLabel.Text = myCal.SelectedDate.ToShortDateString(); þ Press F5 to run the form WebForm1.aspx is the default page for the project, so running the project will launch WebForm1. 1. Press F5. 2. Click the days in the Calendar and verify that the label

32、updated with the selected date. þ Stop the form 1. Close the browser window. 2. Click the stop button. Exercise 2: Working In HTML View In this exercise, you will explore the additional features that enable you to directly manipulate the HTML and XML tags that make up the visual elements of a

33、 Web Form. º Estimated time to complete this lab: 15 minutes. þ Add a new Web Form to the project 1. Close any open forms 2. To create another new Web Form, select Add Web Form from the Project menu 3. For Name, type WebForm2.aspx 4. Click Open to create and open the form. þ Set this as the

34、project’s startup form 1. Find WebForm2.aspx in the Solution Explorer window. 2. Right-click WebForm2.aspx. 3. Select Set As Start Page from the context menu þ Add an HTML button to the form 1. Select the form and press Enter a few times to add some blank lines to the form 2. Select the HTML t

35、ab in the toolbox. 3. Drag a Button control to the first blank line in the form. þ Mark the Button to run as a server control 1. Right-click the Button 2. Select Run At Server from the context menu. þ Add a Label control to the form 1. Select the Web Forms tab in the toolbox. 2. Drag a Label

36、control to the next blank line in the form. þ Double-click the Button This will generate a stub event handler for the Html Button’s default event, "ServerClick." 1. Double-click the Button. þ Add some code to the Button1_ServerClick event handler 1. Within the event handler routine, enter: Lab

37、el1.Text = Now.ToShortDateString(); þ Switch to HTML view 1. Click the WebForm2.aspx tab at the top of your workspace. (Alternatively, you can double-click the WebForm1.aspx file in the Solution Explorer window.) 2. Switch to HTML view by clicking on the HTML button in the lower left corner of t

38、he editor (next to the Design button). 3. Find the Properties Window. 4. From the dropdown list at the top of this window, select DOCUMENT. 5. Set TargetSchema to HTML 4.0 þ Open the Document Outline window 1. Select View >Other Windows >Document Outline from the menu. þ Navigate to Label1

39、using the Document Outline 1. Click the Label1 node in the Document Outline. 2. Position your cursor at a blank space within the tag for Label1 3. Type: BackColor = 4. Use the inline color picker to choose a BackColor for Label1 Bug: In the Beta1 PreRelease, the color picker may no

40、t work when clicking once on the Color Picker, but by moving the caret elsewhere, the Color Picker can be made to appear. þ Add client event handlers for Button1 1. After the last tag, and before the tag, add the following code: 2. Change the code for Button1 to use the onmouseover and onmouse

42、out functions that we just created: Note: In future versions, and the final release of Visual Studio.NET, the man

43、ual process of function stub code generation will no longer be required. þ Press F5 to run the form 1. Press F5. 2. Click the button to display the label. Note that the background color of the button changes when you hover over it with the mouse. þ Stop the form 1. Close the browser window.

44、 2. Click the stop button. Exercise 3: Input Validation In this exercise, you will add input validation to a form using extremely easy RAD techniques – usually no code is required. For invalid values, your form will give the user immediate feedback that she can use to correct her input befor

45、e submitting the form to the Web server. º Estimated time to complete this lab: 15 minutes. þ Add a new Web Form to the project 1. Close any open forms 2. To create another new Web Form, select Add Web Form from the Project menu 3. For Name, type WebForm3.aspx 4. Click Open to create and open

46、the form. þ Set this as the project’s startup form 1. Find WebForm3.aspx in the Solution Explorer window. 2. Right-click WebForm3.aspx. 3. Select Set As Start Page from the context menu þ Add three TextBoxes to the form 1. Select the form and press Enter a few times to add some blank lines to

47、the form 2. Select the Web Forms tab in the toolbox. 3. Drag a TextBox control to the first blank line in the form. 4. Drag a TextBox control to the next line in the form. 5. Set the TextMode property of the TextBox to Password. 6. Drag a TextBox control to the third line in the form. 7. Set

48、the TextMode property of the TextBox to Password. þ Add an HTML Submit button to the form 1. Select the HTML tab in the toolbox. 2. Drag a Submit Button control to the first blank line in the form. þ Add three RequiredFieldValidators to the form 1. Select the Web Forms tab in the toolbox. 2. D

49、rop a RequiredFieldValidator to the right of each TextBox. 3. Set the ControlToValidate property of RequiredFieldValidator1 to TextBox1. 4. For Text, type Required! 5. Repeat for each of the other RequiredFieldValidators. þ Add a CompareValidator to the form 1. Drop a CompareValidator to the ri

50、ght of TextBox3. 2. Set it’s ControlToValidate property to TextBox3. 3. Set the ControlToCompare property to TextBox2. 4. For Text, type Compare Failed! þ Press F5 to run the form 1. Press F5. þ Test the form validation 1. First, click the Submit button on the form. You will see the "Require

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服