2011年6月21日

T-SQL 日期格式化

摘要: T-SQL日期相关1、日期格式化处理DECLARE @dt datetimeSET @dt=GETDATE()--1.短日期格式:yyyy-m-dSELECT REPLACE(CONVERT(varchar(10),@dt,120),N'-0','-')--2.长日期格式:yyyy年mm月dd日 --A. 方法1 SELECT STUFF(STUFF(CONVERT(char(8),@dt,112),5,0,N'年'),8,0,N'月')+N'日'--B. 方法2 SELECT DATENAME(Year,@dt) 阅读全文

posted @ 2011-06-21 20:07 AndyCai 阅读(4530) 评论(1) 推荐(0) 编辑

注册光标丢失的事件

摘要: 有时我们需要当鼠标离开某个textbox 时触发一个隐藏的button事件来处理一些逻辑.Page_Load 中 //注册txtQty和txtOriUintPrice光标丢失的事件(通过调用btnCalcAmount的click事件实现) txtQty.Attributes["onblur"] = Page.GetPostBackEventReference(btnCalcAmount); txtOriUintPrice.Attributes["onblur"] = Page.GetPostBackEventReference(btnCalcAmount 阅读全文

posted @ 2011-06-21 20:05 AndyCai 阅读(307) 评论(1) 推荐(0) 编辑

2011年1月26日

ASP:Menu 在IE8中显示不正确的解决方法

摘要: 使用VS2008 开发的Web 页面,用到了Menu 控年,发现在IE 8 下显示不正确,会出现空白.发现是由于MENU不符合Web标准引起的有三种解决方案:详见http://blogs.msdn.com/giorgio/archive/2009/02/01/asp-net-menu-and-ie8-rendering-white-issue.aspx1:重写 CSS控制样式中的z-index 属性 将动态弹出菜单的 z-index设大。如:z-index: 100;http://weblogs.asp.net/mhildreth/archive/2009/01/26/testing.aspx 阅读全文

posted @ 2011-01-26 15:30 AndyCai 阅读(320) 评论(0) 推荐(0) 编辑

2011年1月11日

Sql server 查询条件中将通配符作为文字使用

摘要: 在Sql server 查询中有百分号 (%)、下划线 (_) 和左括号 ([) 通配符,但有时候字段中的数据本身含有这些符号. 需要查询出含有这些符号的数据。就需要把通配符转成普通的字符使用.只需要加上[]. 如:LIKE 'Msg[_]%',就能查出Msg_ 打头的数据。 阅读全文

posted @ 2011-01-11 15:13 AndyCai 阅读(429) 评论(0) 推荐(0) 编辑

2010年12月7日

页面刷新后滚动条定位

摘要: 1.去除页面头部DOCTYPE html的HTML验证。html xmlns="http://www.w3.org/1999/xhtml"2.为body添加onscroll与onload事件。body onscroll="onscrollform();" onload="formOnload();"js 方法:function onscrollform(){document.all["scrollPoint"].value = document.body.scrollTop; } function formOnload(){ var scrollPoint = document.all 阅读全文

posted @ 2010-12-07 14:54 AndyCai 阅读(540) 评论(0) 推荐(0) 编辑

2010年12月1日

window.open 弹出页面回写父页面值及触发父页面Button事件

摘要: 父页面前台open JS:function changeBOM(GVNo,EmpNo,DataReceiver,ButtonReceiver){//DataReceiver 需要通过弹出页面回写父页面控件的clientid.//ButtonReceiver 需要通过弹出页面触发父页面Button控件的clientid. window.open("../xxxx.aspx?GVNo="+GVNo+"... 阅读全文

posted @ 2010-12-01 16:04 AndyCai 阅读(740) 评论(0) 推荐(0) 编辑

两个自己写的合并GridView 行的方法

摘要: 代码Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--publicvoidMergeRow(GridViewgv,intcellNum){inti=0;introw=0;foreach(KeyValuePair<string,int>kpin... 阅读全文

posted @ 2010-12-01 15:45 AndyCai 阅读(177) 评论(0) 推荐(0) 编辑

2010年10月20日

模态对话框对父页面控件回写值

摘要: 父页面: String url = "../Public/xxxx.aspx?"; StringBuilder script = new StringBuilder(); script.Append("<script language=javascript>window.showModalDialog('"); script.Append(url); script.Append("'+... 阅读全文

posted @ 2010-10-20 16:43 AndyCai 阅读(275) 评论(0) 推荐(0) 编辑

2010年10月13日

解决 TextBox 的 ReadOnly 属性为 true 时,刷新页面后值丢失的方法

摘要: 在 ASP.NET 1.0 中是ReadOnly=True会回传的。 在 ASP.NET 2.0 中是ReadOnly=True就不会回传了。解决的方法: <asp:textbox id="Username" runat="server" ReadOnly="True"></asp:textbox> 去掉ReadOnly="True",改成 <asp:textbox ... 阅读全文

posted @ 2010-10-13 13:17 AndyCai 阅读(553) 评论(0) 推荐(0) 编辑

2010年7月9日

用流打开open office ods 文件

摘要: string template = "Template.ods";string path = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["TemplateSavePath"].ToString().Trim()+template);Response.Clear();Response.AppendHea... 阅读全文

posted @ 2010-07-09 14:29 AndyCai 阅读(1650) 评论(0) 推荐(0) 编辑

导航