2012.10笔记

1.框架里访问上一层
$(document).ready(function () {
            window.top.document.getElementById("Cname").value = "";
            window.top.document.getElementById("phoneNum").value = "";
            window.top.document.getElementById("txCaseport").value = "";
        });
???
parent.document.all("框架ID名").style.height=document.body.scrollHeight;
parent.document.all("框架ID名").style.width=document.body.scrollWidth;

2.访问iframe里的元素用window.frames[] 兼容ff

3.overflow:hidden; 设置超过div高度部分隐藏

4.简单说,就是使用DataPager的SetPageProperties。例如:
Pager1.SetPageProperties(0, PageSize, True)

第一个参数需要特别注意,这个参数是需要显示的第一行的Index,而不是Page Number,所以切

换时需要计算一下页面的第一条记录的Index: (PageNumber - 1) * PageSize
第二个参数是现实的记录数,也就是PageSize
第三个参数指定是否在完成SetPageProperties后重新绑定ListView控件

5.http://www.cnblogs.com/xfrog/archive/2010/09/11/1824086.html

(( from n in dal.T_BBS_Note
  where n.BBS_PlateId == plateId
     && n.TuiJian == 1
 select n).Take(5).Union(
(  from nn in dal.T_BBS_Note
  where nn.BBS_PlateId == plateId
     && nn.NoteState == true
     && nn.TuiJian == 0
 select nn).Take(5)
)).OrderByDescending(p=>p.LastReplayTime);

6.用ul做导航时,padding、margin设置为0

7.js遍历select
for(var i=0;i<document.getElementById(id).options.length;i++)
    {
        if(document.getElementById(id).options[i].value == val)
        {
            document.getElementById(id).options[i].selected=true;
            break;
        }
    }

8.//初始化一维数据
int[]   a1   =   new   int[2];//默认值为0;
int[]   a2   =   new   int[]{1,2};
//初始化等长二维数据
int   [,]   ab1   =   new   int   [2,3];//默认值为0;
int   [,]   ab2   =   new   int   [2,3]{{1,2,3},{4,5,6}};
//初始化不等长二维数据
int   [][]   abc   =   new   int   [2][];
abc[0]   =   new   int[]{1,2};
abc[1]   =   new   int[]{3,4,5,6};


//一步步初始化更有助于理解;
string[][]   ColumnName   =   new   string[3][];
ColumnName[0]   =   new   string[1]   {   "aaa "};
ColumnName[1]   =   new   string[]   { "aaa ", "bbb "   };
ColumnName[2]   =   new   string[3]   { "aaa ", "bbb ", "ccc "   };

9.那根本就不用window.open,用<a href>或document.loaction.href就可以了

10.js获取session的值 var id = '<%=Session["UserName"] %>';

11.Server.UrlDecode()解码
   http://www.189works.com/article-82948-1.html

12.产品对比可用session防止刷新对比信息丢失

13.=与==的使用

14.using System.Web.UI.HtmlControls;

15.datetime
http://www.cnblogs.com/chinafine/articles/1436264.html
DayOfWeek

16.dropdownlist 绑定
   BLLAccount bll_getProject = new BLLAccount();
            ddl_project.DataSource = bll_getProject.getProject();
            ddl_project.DataValueField = "Code";
            ddl_project.DataTextField = "Name";
            ddl_project.DataBind();
            ddl_project.Items.Insert(0, new ListItem("请选择项目", ""));

17.float的转化Convert.ToSingle()
   js 转换为int型 parseInt()

原文地址:https://www.cnblogs.com/wuchao/p/2715304.html