|
![]() |
名片设计 CorelDRAW Illustrator AuotoCAD Painter 其他软件 Photoshop Fireworks Flash |
|
通过事例学习.net的WebForms技术(一) /* 豆腐制作,都是精品 http://www.asp888.net 豆腐技术站 如转载 请保留完整版权信息 */ TextBox: TextBox 在asp.net中是录入的控件,他有三种形式,分别对应<input type=text>,<input type=password>和<TextArea> 这三个HTML标签,在asp.net 中,TextBox的定义格式是 <asp:TextBox runat=server id="text1" Text="豆腐技术站" ...... /> 代码定义方法 <script language="C#" runat=server> void AddText(){ TextBox text1=new TextBox(); text1.Text="豆腐技术站"; 。。。。。。 } </script> 上面是对TextBox的简朴介绍,下面具体来看看TextBox的一些主要的属性和他们的使用方式 AccessKey,可以使该TextBox在页面上通过ALT+[指定键]得到焦点:例如: <asp:TextBox id="TextBox1" Text="豆腐制作 http://www.asp888.net" runat="server"/> 或者: TextBox1.AccessKey="Y"; Attributes, 给TextBox控件的属性赋值,比如: TextBox1.Attributes["maxlength"]="20"; 通过Attributes 可以很方便的给TextBox确定一些在HTML 中很方便的赋值 TextMode 是TextBox 中的一个异常异常重要的一个属性,我们需要利用他来确定我们当前的输入的类型 他的三种赋值 TextBox1.TextMode=TextBoxMode.SingleLine; //单行输入框 TextBox1.TextMode=TextBoxMode.MultiLine; //多行输入框 TextBox1.TextMode=TextBoxMode.Password; //密码输入框 Text 是我们存取TextBox的输入框中数据的属性,他是可读可写的 此外,还有一些对于TextBox的外观属性的一些控制属性,比如 Font,ToolTip 等等,因为基本上不存在需要在编程 中控制实现,所以 就 没有在这里具体讲解 Label 是我们在Asp.Net中用来显示输出的控件,对于这个空间我们也是仍旧有两种的定义方法 <asp:Label runat=server id="label" Text="豆腐技术站" ...... /> 代码定义方法 <script language="C#" runat=server> void AddText(){ Label label1=new Label(); label.Text="豆腐技术站"; 。。。。。。 } </script> 其中,我们最常用的就是Text的属性 返回类别: 教程 上一教程: ASP系列讲座(五)使用变量和常量 下一教程: 菜鸟学 DreamWeaver MX 做 ASP 您可以阅读与"通过事例学习.net的WebForms技术(一)"相关的教程: · 通过事例学习.net的WebForms技术(二) · 通过事例学习.net的WebForms技术(三) · 通过事例学习.net的WebForms技术(四) · NET移植案例学习:建造Web站点(4) · NET移植案例学习:建造Web站点(3) |
![]() ![]() |
快精灵印艺坊 版权所有 |
首页![]() ![]() ![]() ![]() ![]() ![]() ![]() |