悟生慧

 
上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 27 下一页

2011年3月31日

asp.net中实现在文本框按下回车键后相当于按下tab键focus跳到下一个文本框

摘要: public static void AddOnKeyDown(System.Web.UI.WebControls.TextBox tb, String strButtonID) { tb.Attributes.Add("onkeydown ", String.Format("if(event.keyCode==13 || event.keyCode==10) {{document.getElementById( '{0} ').click();return false;}} ", strButtonID)); } 阅读全文

posted @ 2011-03-31 14:55 悟生慧 阅读(1270) 评论(0) 推荐(0)

2011年3月28日

ASP.NET获取<EmptyDataTemplate></EmptyDataTemplate>模板中的textBox控件值

摘要: 前台<EmptyDataTemplate> <table> <tr style="color: Black; background-color: SkyBlue; font-weight: bold;"> <th scope="col" style="width: 10px;"> &nbsp; </th> <th scope="col" style="width: 190px;"> 名称 </th> &l 阅读全文

posted @ 2011-03-28 15:12 悟生慧 阅读(1220) 评论(0) 推荐(0)

ASP.NETLinkButton的Click事件中获取CommandArgument的值

摘要: /// <summary> /// LinkButton的onClick事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void linkBtnName_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; //强转一下。 String SelectedKeyV 阅读全文

posted @ 2011-03-28 15:09 悟生慧 阅读(2689) 评论(1) 推荐(0)

关于绑定了GridView控件后怎么截取字符串和CSS样式来控制表头不换行

摘要: 第一种:<HTML> <HEAD> <TITLE> New Document </TITLE> <style type="text/css"> .aa{ display: block; width: 200px; overflow: hidden; white-space: nowrap; -o-text-overflow: ellipsis; text-overflow: ellipsis; } </style> </HEAD> <BODY> <div class=&qu 阅读全文

posted @ 2011-03-28 14:41 悟生慧 阅读(515) 评论(0) 推荐(0)

winfrom的TextBox获取光标

摘要: this.ActiveControl = txtStuName; 阅读全文

posted @ 2011-03-28 13:04 悟生慧 阅读(275) 评论(0) 推荐(0)

初始化页面的时候,如何使TextMode="Password"的asp:textbox有默认值显示?

摘要: <asp:textbox id="tboxPsw" runat="server" TextMode="Password" Width="170px"></asp:textbox>答2:tboxPsw.Attributes.Add("value","12343"); 阅读全文

posted @ 2011-03-28 13:02 悟生慧 阅读(1048) 评论(0) 推荐(0)

2011年3月26日

C#验证输入数据的字节数包括中文和英文

摘要: public int GetBytesOfString(string str) {//获取字符串的字节数 byte[] bytes = Encoding.Unicode.GetBytes(str); int n = 0; for (int i = 0; i < bytes.GetLength(0); i++) { // 偶数位置,如0、2、4等,为UCS2编码中两个字节的第一个字节 if (i % 2 == 0) { n++; // 在UCS2第一个字节时n加1 } else { // 当UCS2编码的第二个字节大于0时,该UCS2字符为汉字,一个汉字算两个字节 if (bytes[i] 阅读全文

posted @ 2011-03-26 16:51 悟生慧 阅读(689) 评论(0) 推荐(1)

asp.net中RegularExpressionValidator控件中正则表达式用法

摘要: 验证数字:只能输入1个数字 表达式 ^\d$ 描述 匹配一个数字 匹配的例子 0,1,2,3 不匹配的例子 只能输入n个数字 表达式 ^\d{n}$ 例如^\d{8}$ 描述 匹配8个数字 匹配的例子 12345678,22223334,12344321 不匹配的例子 只能输入至少n个数字 表达式 ^\d{n,}$ 例如^\d{8,}$ 描述 匹配最少n个数字 匹配的例子 12345678,123456789,12344321 不匹配的例子 只能输入m到n个数字 表达式 ^\d{m,n}$ 例如^\d{7,8}$ 描述 匹配m到n个数字 匹配的例子 12345678,1234567 不匹配的例 阅读全文

posted @ 2011-03-26 15:37 悟生慧 阅读(853) 评论(0) 推荐(0)

2011年3月25日

ASP.NET 中Textbox只能输入数字,不能输入其他字符

摘要: 解决办法如下:<asp:TextBox ID="txtpage" runat="server" Width="61px"OnKeyPress="if(((event.keyCode>=48)&&(event.keyCode <=57))||(event.keyCode==46)) {event.returnValue=true;} else{event.returnValue=false;}"></asp:TextBox> 阅读全文

posted @ 2011-03-25 17:22 悟生慧 阅读(853) 评论(0) 推荐(0)

ASP.NET 中Textbox只能输入数字放在前台验证喔

摘要: 解决办法如下:<asp:TextBox ID="txtpage" runat="server" Width="61px"OnKeyPress="if(((event.keyCode>=48)&&(event.keyCode <=57))||(event.keyCode==46)) {event.returnValue=true;} else{event.returnValue=false;}"></asp:TextBox> 阅读全文

posted @ 2011-03-25 17:22 悟生慧 阅读(738) 评论(0) 推荐(0)

上一页 1 ··· 17 18 19 20 21 22 23 24 25 ··· 27 下一页

导航