asp.net清空页面上的所有TextBox
摘要:Asp.net中一次性清空页面上的所有TextBox中的内容,由于TextBox在客户端以<input type=”text”>形式来呈现的,因此解决方案有客户端和服务器端两种方式,服务器端包括两种方法!这个破东西在asp.net面试题中广为流传(我感受颇深).方法一:Code1foreach (Control c in this.FindControl("form1").Controls)2{3 if (c is TextBox)4 {5 ((TextBox)c).Text = "";6 }7}8910方法二:Code1 FieldInfo
阅读全文
posted @
2011-05-31 18:04
张@天
阅读(531)
推荐(0)
检索 COM 类工厂中 CLSID 为 {91493441-5A91-11CF-8700-00AA0060263B} 的组件时失败解决方法
摘要:检索 COM 类工厂中 CLSID 为 {91493441-5A91-11CF-8700-00AA0060263B} 的组件时失败,原因是出现以下错误: 80070005 在CSDN上总是有网友问这个问题,自己也遇到过,因些写出来供参考:症状:oWordApplic = New Word.Application当程序运行到这句时出现下面的错误:检索 COM 类工厂中 CLSID 为 {91493441-5A91-11CF-8700-00AA0060263B} 的组件时失败,原因是出现以下错误: 80070005。oWordApplic = New Word.Application当程序运行到这
阅读全文
posted @
2011-05-25 15:33
张@天
阅读(2788)
推荐(1)
WinForm Timer组件的用法
摘要:if(strSelectedItemName=="True"){this.timer1.Enabled=true;this.timer1.Start();return;}else{this.timer1.Stop();//停止计时}3种Timer的用法(转) 关于C#中timer类在C#里关于定时器类就有3个1.定义在System.Windows.Forms里2.定义在System.Threading.Timer类里"3.定义在System.Timers.Timer类里System.Windows.Forms.Timer是应用于WinForm中的,它是通过Wind
阅读全文
posted @
2011-05-25 11:09
张@天
阅读(4590)
推荐(1)
oracle数据导出与导入cmd命令
摘要:导出将数据库(test)完全导出,用户名sys 密码manager 导出到D:\daochu.dmp中 exp sys/manager@test file=d:\daochu.dmp full=y导入将D:\daochu.dmp 中的数据导入 test数据库中。 imp sys/manager@test file=d:\daochu.dmp
阅读全文
posted @
2011-05-24 14:19
张@天
阅读(1013)
推荐(1)
ASP.NET 中防止TreeView展开时刷新
摘要:TreeView控件的EnableClientScript属性设置为False(默认为True)
阅读全文
posted @
2011-05-20 16:19
张@天
阅读(292)
推荐(0)
js控制FileUpload上传控件把上传的文件添加到指定的div中
摘要:<head runat="server"> <title>无标题页</title> <script type="text/javascript"> function fileAdd() { var file_appendixs = document.getElementById("file_appendix").value; var arrfile = new Array(); arrfile = file_appendixs.split("\\"); var A =
阅读全文
posted @
2011-05-17 15:11
张@天
阅读(1378)
推荐(1)
如何让web控件FileUpload选择完文件之后就自动触发事件,让Image控件显示出图片来
摘要:function SelectImg(url){ document.all.item("ProductImg").src=document.getElementById("FileUpload1").value; }<asp:FileUpload ID="FileUpload1" runat="server" onchange="SelectImg(this)" />
阅读全文
posted @
2011-05-16 10:44
张@天
阅读(2339)
推荐(0)
字符串的截取
摘要:/// 截取字符串,不限制字符串长度 /// 待截取的字符串 /// 每行的长度,多于这个长度自动换行 public string CutStr(string str, int len) { string s = ""; for (int i = 0; i < str.Length; i++) { int r = i % len; int last = (str.Length / len) * len; if (i != 0 && i <= last) { if (r == 0) { s += str.Substring(i - len, len
阅读全文
posted @
2011-05-16 09:30
张@天
阅读(525)
推荐(0)
winform中listView
摘要:1, 获取当前行的行号: int index = ((ListViewDataItem)e.Item).DisplayIndex;2,获取当前行的主键: int id = Convert.ToInt32(ListView1.DataKeys[index].value);protectedvoidListView1_ItemCommand(objectsender,ListViewCommandEventArgse){//获取当前行号;intindex=((ListViewDataItem)e.Item).DisplayIndex;//获取当前行号的主键;intid=Convert.ToInt3
阅读全文
posted @
2011-05-12 12:49
张@天
阅读(702)
推荐(0)
JS正则验证邮箱的格式
摘要:一.相关的代码1functiontest()2{3vartemp=document.getElementById("text1");4//对电子邮件的验证5varmyreg=/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;6if(!myreg.test(temp.value))7{8alert('提示\n\n请输入有效的E_mail!');9myreg.focus();10returnfalse;11}12}13//由
阅读全文
posted @
2011-05-10 10:21
张@天
阅读(523)
推荐(0)
C#读取文件内容
摘要: StreamReader objReader = new StreamReader("c:\\test.txt"); string sLine=""; ArrayList arrText = new ArrayList(); while (sLine != null) { sLine = objReader.ReadLine(); if (sLine != null) arrText.Add(sLine); } objReader.Close(); foreach (string sOutput in arrText) Console.WriteLi
阅读全文
posted @
2011-05-06 16:08
张@天
阅读(520)
推荐(0)
asp.net发送邮件代码
摘要: #region 发送邮件 //创建邮件信息 objMailMessage = new MailMessage(); //objMailMessage.From = "zhangandfang6862@sina.com";//源邮件地址 objMailMessage.From = strStrmail_Addresser; //objMailMessage.To = "450627136@qq.com";//目的邮件地址 objMailMessage.From = strEail_Accepy; objMailMessage.Subject = txt
阅读全文
posted @
2011-05-04 17:37
张@天
阅读(325)
推荐(0)
C#中常用的语句
摘要:1. 打开新的窗口并传送参数: 传送参数:response.write("<scrīpt>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</scrīpt>") 接收参数:string a = Request.QueryString("id");string b = Request.QueryString("id1"); 2.为按钮添加对话框Button1.Attributes.Add(&quo
阅读全文
posted @
2011-05-04 17:17
张@天
阅读(796)
推荐(0)
TreeView选中子节点父节点也选中,反之选中父节点子节点也选中
摘要:做的项目,需要用到TreeView来处理一些分级数据,并能允许同时选中多个节点(要求选中父节点,那么子节点也相应的选中),即要用TreeView的ShowCheckBox属性。但在使用时发现,在选中复选框时不会引起回发事件,于是一顿猛Google。看到使用__doPostBack和后台注册onclick事件可以解决此问题,用上后却一直报__doPostBack()‘缺少对象’错误,在网上又搜到“NET 生成javascript的 __doPostBack()函数是有条件的,当页面上存在一个或一个以上的LINKBUTTON的时候才会有这个函数,所以,如果页面上没有LINKBUTTON只有BUTT
阅读全文
posted @
2011-05-04 15:00
张@天
阅读(3229)
推荐(0)
js判断Checkbox的全选,反选,多选与只能选一个
摘要://弹出页面代码function ShowMDialog(URL,Width,Height,scrollbars){ return window.showModalDialog(URL, "","dialogWidth:"+Width+"px;dialogHeight:"+Height+"px; status:no;directories:no; scrollbars:"+scrollbars+";Resizable:no; ");}//全选与反选<script type="te
阅读全文
posted @
2011-05-04 14:57
张@天
阅读(2163)
推荐(1)