随笔分类 -  Dot Net相关代码总结

控制弹出页面大小,显示标记,按ctrl+enter发送,插入dropdownlist
摘要:控制弹出页面大小:function openScript(url, width, height){ var Win = window.open(url,"openScript",'width=' + width + ',height=' + height + ',resizable=no,scrollbars=no,menubar=no,status=yes' ); }显示标记:Server.Ht... 阅读全文
posted @ 2006-03-20 14:48 多铭 阅读(838) 评论(0) 推荐(0)
上传控件
摘要:前台:<formid="upload"method="post"encType="multipart/form-data"runat="server"><tableclass="border"id="uploadtable"height="99%"cellSpacing="0"cellPadding="0"width="98%"align="center"border="0"ru... 阅读全文
posted @ 2006-03-20 14:20 多铭 阅读(323) 评论(0) 推荐(0)
读写web.config
摘要:using System.Data;读web.config:string str_webconfig = Server.MapPath("Web.config");DataSet dsxml = new DataSet();dsxml.ReadXml(str_webconfig);newsname.Text = dsxml.Tables[1].Rows[0][1].ToString();newsu... 阅读全文
posted @ 2006-03-20 13:05 多铭 阅读(750) 评论(0) 推荐(0)
框架结构中的页面跳转
摘要:Response.Write("<script>top.window.location.href('index.aspx')</script>"); 阅读全文
posted @ 2006-03-20 12:57 多铭 阅读(1165) 评论(1) 推荐(0)
颜色交替与按钮提示
摘要:private void dgrp_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e){if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Label g=... 阅读全文
posted @ 2006-03-20 12:53 多铭 阅读(258) 评论(0) 推荐(0)
delete复选框(用于datagrid)
摘要:javascript代码:function select_deselectAll(chkVal,idVal){ var frm = document.forms[0]; for (i=0; i<frm.length; i++) { if (idVal.indexOf ('CheckAll') != -1) { if(chkVal == true) { frm.elements[i].ch... 阅读全文
posted @ 2006-03-20 12:50 多铭 阅读(392) 评论(0) 推荐(0)
数据库操作
摘要:using System.Configuration;using System.Data.OleDb ;using System.Data .SqlClient ;using System.Data ;///<add key="msolepath" value="Provider=SQLOLEDB.1;DataSource=(local);Initial Catalog=XXX;uid=zm... 阅读全文
posted @ 2006-03-20 12:08 多铭 阅读(304) 评论(0) 推荐(0)
合法用户验证(用于每一子页面)
摘要:/// <summary>///验证/// </summary>/// ex:Validate(Session,this,1,2,pagename);///userid = DecryptCookie(Session["userid"].ToString(),1);///userpwd = DecryptCookie(Session["userpwd"].ToString(... 阅读全文
posted @ 2006-03-20 12:00 多铭 阅读(286) 评论(0) 推荐(0)
合法用户验证函数(用于登录页面)
摘要:/// /// 用户验证 /// ///ex:Session["userid"]=sjmain.US.smis.Functions.EncryptCookie(username.Value.Trim(),1); ///Session["userpwd"]=sjmain.US.smis.Functions.EncryptCookie(password.Value.Trim(),2); pub... 阅读全文
posted @ 2006-03-20 11:48 多铭 阅读(274) 评论(0) 推荐(0)
数据加密3(不可逆)
摘要:/// /// 加密字符串,使用不同加密方法 /// /// encrypting string /// format,0 is SHA1,1 is MD5 /// public static string Encrypt(string stringToEncrypt,int encryptMethod) { string str = ""; switch(encryp... 阅读全文
posted @ 2006-03-20 11:42 多铭 阅读(174) 评论(0) 推荐(0)
数据加密2(可逆)
摘要:/// /// 加密 Cookie字符串 /// /// 需要加密的cookie字符串 /// /// 加密过的cookie字符串 public static string EncryptCookie(string cookie,int type) { string str = En(cookie,type); StringBuilder sb = new String... 阅读全文
posted @ 2006-03-20 11:40 多铭 阅读(218) 评论(0) 推荐(0)
数据加密1(可逆)
摘要:/// /// 加密字符串 /// /// stringusing System.Web.Security; public static string Encrypt(string stringToEncrypt) { string str = ""; FormsAuthenticationTicket ticket = new System.Web.Security.For... 阅读全文
posted @ 2006-03-20 11:38 多铭 阅读(263) 评论(0) 推荐(0)
字符处理
摘要:1/**//// 2/// HTML encode 3/// 4/// string 5/// 6public static string Encode(string str) 7{ 8 str = str.Replace("&","&amp;"); 9 str = str.Replace("'","''");10 str = str.Repla... 阅读全文
posted @ 2006-03-19 13:25 多铭 阅读(188) 评论(0) 推荐(0)