摘要: TreeView控件的EnableClientScript属性设置为False(默认为True) 阅读全文
posted @ 2011-05-20 16:19 张@天 阅读(258) 评论(0) 推荐(0) 编辑
摘要: <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 张@天 阅读(1351) 评论(0) 推荐(1) 编辑
摘要: 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 张@天 阅读(2283) 评论(1) 推荐(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 张@天 阅读(498) 评论(0) 推荐(0) 编辑
摘要: 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 张@天 阅读(675) 评论(0) 推荐(0) 编辑
摘要: 一.相关的代码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 张@天 阅读(507) 评论(0) 推荐(0) 编辑
摘要:  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 张@天 阅读(512) 评论(0) 推荐(0) 编辑
摘要:  #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 张@天 阅读(311) 评论(0) 推荐(0) 编辑
摘要: 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 张@天 阅读(776) 评论(0) 推荐(0) 编辑
摘要: 做的项目,需要用到TreeView来处理一些分级数据,并能允许同时选中多个节点(要求选中父节点,那么子节点也相应的选中),即要用TreeView的ShowCheckBox属性。但在使用时发现,在选中复选框时不会引起回发事件,于是一顿猛Google。看到使用__doPostBack和后台注册onclick事件可以解决此问题,用上后却一直报__doPostBack()‘缺少对象’错误,在网上又搜到“NET 生成javascript的 __doPostBack()函数是有条件的,当页面上存在一个或一个以上的LINKBUTTON的时候才会有这个函数,所以,如果页面上没有LINKBUTTON只有BUTT 阅读全文
posted @ 2011-05-04 15:00 张@天 阅读(3155) 评论(3) 推荐(0) 编辑
摘要: //弹出页面代码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 张@天 阅读(2139) 评论(0) 推荐(1) 编辑
摘要: 1 1、 OpenFileDialog控件有以下基本属性 2 3 4 InitialDirectory 对话框的初始目录 5 Filter 要在对话框中显示的文件筛选器,例如,"文本文件(*.txt)|*.txt|所有文件(*.*)||*.*" 6 FilterIndex 在对话框中选择的文件筛选器的索引,如果选第一项就设为1 7 RestoreDirectory 控制对话框在关闭之前是否恢复当前目录 8 FileName 第一个在对话框中显示的文件或最后一个选取的文件 9 Title 将显示在对话框标题栏中的字符 10 AddExtension 是否自动添加默认扩展名 1 阅读全文
posted @ 2011-03-28 17:38 张@天 阅读(826) 评论(0) 推荐(0) 编辑
摘要:  1 private void btnWork_Click(object sender, EventArgs e) 2 { 3 openFileDialog = new OpenFileDialog(); 4 openFileDialog.Filter = "所有资源|*.*"; 5 openFileDialog.InitialDirectory = @"C:\Projects\erp"; 6 openFileDialog.ValidateNames = true; 7 openFileDialog.CheckFileExists = true; 8 阅读全文
posted @ 2011-03-28 17:36 张@天 阅读(551) 评论(2) 推荐(0) 编辑
摘要: //得到选中的项 string strType = "";//车损损失类别 if (this.cbc_lost_type_ids.CheckedItems.Count > 0) { foreach (System.Data.DataRowView item in this.cbc_lost_type_ids.CheckedItems) { strType += item.Row["DICT_KEY"].ToString() + ","; } }//根据值使复选框选中 int icount = cbc_lost_type_ids. 阅读全文
posted @ 2011-03-23 17:01 张@天 阅读(591) 评论(0) 推荐(0) 编辑
摘要: 1 方法: 2 public string RndNum(int VcodeNum) 3 { 4 string Vchar = "0,1,2,3,4,5,6,7,8,9"; 5 string[] VcArray = Vchar.Split(new Char[] { ',' }); 6 string VNum = ""; 7 //int temp = -1; 8 Random rand = new Random(); 9 for (int i = 1; i < VcodeNum + 1; i++)10 {11 int t = rand 阅读全文
posted @ 2011-03-14 16:18 张@天 阅读(371) 评论(0) 推荐(0) 编辑