}===================================select isnull(@s1,'uffjf') sql语句中判断为空则值默认为后面的参数判断是否为null是 if (@param is null)不是if (@param = null)===================================在formview里面做dropdownlist的数据联动时会出错,可以不绑定,而在代码中(inserting或updateing时)添加params的defaultvalue就可以解决===================================新打开一页asp.net控件:ImageButton1.Attributes.Add("onclick", "javascript:window.open('XXX.aspx','_blank');return false");===================================客户端可以myinput.focus()获得焦点//以前竟然不知道 晕===================================如果不想某个按钮执行验证控件的检测,则可以把他的(按钮的)CausesValidation设置为false===================================sql datasource中updated后e.affectrows可以取得影响的行数,或者mp返回值===================================网易邮箱登录input的颜色样式txtUsername.Attributes.Add("onMouseOver", "this.style.borderColor='#9ecc00'");txtUsername.Attributes.Add("onMouseOut", "this.style.borderColor='#84a1bd'");===================================insertting时检测重复,e.cancel = true;然后return就可以保存状态===================================IIS中如果想有某文件夹的写权限可以设置network service用户权限。====================================sqlDataSource把CancelSelectOnNullParameter设为false则可以传入空的参数。====================================客户端获取asp.net的lable控件的值不要document.getElementbyID('').value;而是应该document.getElementbyID('').innerText; or innerHTML====================================asp.net的控件比如textbox设置为readonly=true则用javascript添加他的value值,然后后台就取不到====================================在</head>之前增加<base target="_self" />,则var a=window.showModalDialog("GetInv3.aspx",'a',"dialogWidth=1000px;dialogHeight=740px");出来的窗体在自己内部跳转超链接。====================================根据数据改变Gridview的颜色: for (int i = 0; i < gvInvAlert.Rows.Count; i++) { if (gvInvAlert.Rows[i].Cells[7].Text == "报警") { gvInvAlert.Rows[i].ForeColor = System.Drawing.Color.Red; } }但是此方法只对非模板列起作用,如果不想在edit时显示某列,可以设置其applyformatinEditmod为false====================================Request.ServerVariables["HTTP_USER_AGENT"];//获取浏览器信息Request.ServerVariables["REMOTE_ADDR"];//获取ip地址====================================<input οnfοcus="if( this.value=='用 Google 搜索本站') {this.value='' };" id="gq" value="用 Google 搜索本站" type="text">====================================if string.IsNullOrEmpty()==================================== protected void gvStoreInit_RowDataBound(object sender, GridViewRowEventArgs e) { //鼠标经过griadview时改变样式 string sCSSover = "mosovTR"; string sCSSout = "mosoutTR"; if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "this.className = '" + sCSSover + "'"); e.Row.Attributes.Add("onmouseout", "this.className = '" + sCSSout + "'"); } }==================================== public class JavaScriptConstant { internal const string jsClickAndDoubleClick = @"<script type=""text/javascript""> //<![CDATA[ var isDoubleClick = false; function yy_RowClick(id) { setTimeout(""yy_RowClickTimeout('""+id+""')"", 300); } function yy_RowClickTimeout(id) { if (isDoubleClick == false) { // 执行ID所指按钮的click事件 document.getElementById(id).click(); } isDoubleClick = true; } function yy_RowDoubleClick(id) { if (isDoubleClick == true) { // 执行ID所指按钮的click事件 document.getElementById(id).click(); } isDoubleClick = true; } //]]> </script>"; }=======================================
