我的收藏

Javascript控制页面控件隐藏显示的两种方法,方法的不同之处在于控件隐藏后是否还在页面上占位
方法一:

document.all["panelsms"].style.visibility="hidden";
document.all["panelsms"].style.visibility="visible";


方法二:

document.all["panelsms"].style.display="none";
document.all["panelsms"].style.display="inline";


 

SqlServer查询日期型字段yyyy-mm-dd格式 : convert(varchar(10),exam_begindate,120)


 

文字作为url参数会出乱码,所以编码一下
HttpUtility.UrlEncode(文本参数, Encoding.GetEncoding("utf-8"))

接收参数时也要编码
HttpUtility.UrlDecode(Request.QueryString["home_area_name"], System.Text.Encoding.GetEncoding("GB2312"));


 

OnClientClick="return confirm('确认删除?');"


 

Excel导入的链接字符串(没有乱码,可以识别混合列)
string strConn = "Provider=Microsoft.ACE.OleDb.12.0;" + "Data Source=" + newFilePath + ";" + "Extended Properties='Excel 12.0;HDR=False;IMEX=1'";


 

Js 获取url上的参数
 function GetQueryString(name) {

   var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i");

   var r = window.location.search.substr(1).match(reg);

   if (r!=null) return unescape(r[2]); return null;

}


 

js  动态添加checkbox控件
            var obj = document.getElementById("chkObjList").getElementsByTagName("tr");
            id = "chkObj"
            //var tr = obj.insertRow();
            var td = $(obj[0]).append("<td><input id=/"" + id + "/" type=/"checkbox/"   /><label for=/"CheckBoxList1_1/">" + MsgBox + "</label></td>");


 

checkbox全选、全解除
        $("input[id *= 'chkSelAll']").click(function() { $("input[id *= 'chkSelect']").attr("checked", $("input[id *= 'chkSelAll']").attr('checked')) });



带格式文本控件
前台
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>


<FCKeditorV2:FCKeditor ID="FCKeditor1" runat="server" BasePath="/inc/FCKeditor/" Height="350px">
                    </FCKeditorV2:FCKeditor>

后台
FCKeditor1.Value


 

如何生成Interop.Excel.dll?
进入你的visual studio的sdk下的bin目录,找到TlbImp.exe文件,如果没有,请用光盘安装此文件,详细说明请参照MSDN。
命令行(cmd)进入bin目录,运行TlbImp /out:Interop.Excel.dll Office安装目录+Excel.exe
此时很可能会报错:TlbImp error: Unable to locate input type library: 'c:/program files/mcrosoft offi
ce/office/EXCEL.EXE'
此问题很有可能是TlbImp的bug,不支持空格式的路径;(具体原因不明)不要紧,将Excel.exe拷贝入bin目录,直接运行TlbImp /out:Interop.Excel.dll Excel.exe,提示"Type library imported to Interop.Excel.dll路径"
在bin目录下找到Interop.Excel.dll文件。在你的visual studio里将其引用即可。



下载功能代码
 FileStream stream = null;
            try
            {
                stream = new FileStream(附件地址(逻辑+名), FileMode.Open, FileAccess.Read, FileShare.Read);
                int bufSize = (int)stream.Length;
                byte[] buf = new byte[bufSize];

                int bytesRead = stream.Read(buf, 0, bufSize);
                HttpContext.Current.Response.ContentType = "application/octet-stream";
                HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.IO.Path.GetFileName(physicalFilePath));
                HttpContext.Current.Response.OutputStream.Write(buf, 0, bytesRead);
                //HttpContext.Current.Response.End();
  HttpContext.Current.ApplicationInstance.CompleteRequest();
            }

             catch
                {
                    return false;
                }
                finally
                {
                    stream.Close();
                }


JQ隐藏最后一列

$("#grdWdk tr th:last-child").hide();


JQ设置页面文字颜色

 $("td:contains('未通过')").attr("style", "color: #FF0000");


 

在打开的子窗口刷新父窗口

window.opener.location.reload()


ENTER键可以让光标移到下一个输入框
<input οnkeydοwn="if(event.keyCode==13)event.keyCode=9">

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值