请教一行代码好吗?谢谢您。 你在Windows程序中TextBox是没有Attributes这个属性的,Web程序中有 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Here: System.Web.UI.AttributeCollection WebControl.Attributes 属性 [C#]下面的示例阐释当 TextBox 控件失去焦点时,可以如何使用 WebControl 的 Attributes 属性运行 Javascript 命令。[C#] <%@ Page Language="C#" AutoEventWireup="True" %> <html> <head> <script language="C#" runat="server"> void Page_Load(Object sender, EventArgs e) { TextBox1.Attributes["onblur"]="javascript:alert('Hello! Focus lost from text box!!');"; } </script> </head> <body> <h3>Attributes Property of a Web Control</h3> <form runat="server"> <asp:TextBox id="TextBox1" columns=54 Text="Click here and then tap out of this text box" runat="server"/> </form> </body> </html> 这句是web的代码吧,楼主在winForm中用?winForm中加事件可以这么加的话,那真的要关注一下了。这句的效果在网页中就会是这样<input name="TextBox1" type="text" id="TextBox1" onblur="document.all.Button1.click()" />onblur时就会触发Button1的click Attributes是webcontrol的属性,因为textbox是继承自webcontrol,所以你要查webcontrol的所有成员就能查到 楼主应该是web中的代码,搜索 TextBox 类,你会看到这个属性 这个是web下的代码,功能应该是在textBox获得焦点时作些动作 byte[]转换为string,然后又将string转换byte[]数据怎么会少了一位?急.. 点击文本框日历出不来 C#实现桌面共享的解决方法 点击树菜单的一个子菜单,插入时间…… C#如何格式化字符串,用占位符! (高分)高手请进 C# Union和 位操作 在C#中怎样读数据库中表的某个字段的长度??? 在线等 高手帮忙啊 在net中如何用vb调用c#写的类 急!关于通配符的求救 SQL sever2008 R2 连 VS2013 一个控制另一个窗口的tabControl的问题(在线等!!)多谢! 一个关于,水晶报表连接的问题,
WebControl.Attributes 属性 [C#]
下面的示例阐释当 TextBox 控件失去焦点时,可以如何使用 WebControl 的 Attributes 属性运行 Javascript 命令。
[C#] <%@ Page Language="C#" AutoEventWireup="True" %> <html>
<head>
<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e) {
TextBox1.Attributes["onblur"]="javascript:alert('Hello! Focus lost from text box!!');";
}
</script>
</head>
<body>
<h3>Attributes Property of a Web Control</h3>
<form runat="server">
<asp:TextBox id="TextBox1" columns=54
Text="Click here and then tap out of this text box"
runat="server"/>
</form>
</body>
</html>
这句的效果在网页中就会是这样
<input name="TextBox1" type="text" id="TextBox1" onblur="document.all.Button1.click()" />
onblur时就会触发Button1的click
楼主应该是web中的代码,搜索 TextBox 类,你会看到这个属性