2012.08学习笔记

1.Convert.ToInt32、(int)和int.Parse三者的区别:
前者适合将object类类型转换成int类型
(int)适合简单数据类型之间的转换
int.Parse适合将string类类型转换成int类型

2.Math.Round(decimal.Parse(text1.Text.Trim()),2);

3.String.Format和WriteLine都遵守同样的格式化规则。格式化的格式如下:"{ N [, M ][: formatString ]}", arg1, ... argN,在这个格式中:
1) N是从0开始的整数,表示要格式化的参数的个数
2) M是一个可选的整数,表示格式化后的参数所占的宽度,如果M是负数,那么格式化后的值就是左对齐的,如果M是正数,那么格式化后的值是右对齐的
3) formatString是另外一个可选的参数,表示格式代码
字母  含义
C或c Currency 货币格式
D或d Decimal 十进制格式(十进制整数,不要和.Net的Decimal数据类型混淆了)
E或e Exponent 指数格式
F或f Fixed point 固定精度格式
G或g General 常用格式
N或n 用逗号分割千位的数字,比如1234将会被变成1,234
P或p Percentage 百分符号格式
R或r Round-trip  圆整(只用于浮点数)保证一个数字被转化成字符串以后可以再被转回成同样的数字
X或x Hex 16进制格式

4.货币格式转换
  1._rmoney = string.Format("{0:C2}", fmoney); 
  2.cul = new CultureInfo("zh-CN");//中国大陆  
    _rmoney = fmoney.ToString("c", cul);  

5.asp.net中textbox的AutoPostBack 属性
textbox的AutoPostBack =True 时, 你可以更改页面上的TextBox , 然后使之失去焦点,你会看到浏览器有刷新. 此时浏览器已将TextBox的Text值传回服务器,即使客户端未提交页面,,服务器也可以对传回的值进行处理.

6.获取父节点
parentNode(兼容ie,火狐)

7.ECMAScript标准

8.iframe内的元素获取
 window.frames["vip_confirmcontent"].document.getElementById("Label_styleno").innerHTML = styleNo;

9.onpropertychange
  onkeydown

10.背景透明设置
    background-color: #C0C0C0;
    opacity:0.6;//兼容firefox,safari,chrome,opera
    filter:alpha(opacity=60);//ie

11.div居中
   left:50%;
   margin-left:-div宽度/2;

12.遮盖页面的div
    position:absolute;
    top:0;
    left:0;
    100%;
    height:100%;
    display:block;
    z-index:20;
    background-color: #C0C0C0;
    opacity:0.6;
    filter:alpha(opacity=60);

13.List<string>

14.Request.QueryString
   Request.Form

15.1: 时间类型是可以加减的。可以直接比较a>b
   2: 另外一种
    Datetime a; Datetime b;
    if(a.CompareTo(b) > 0){
    a> b
    }else{
     a<=b
     }

16.asp.net弹出对话框
   this.ClientScript.RegisterStartupScript(this.GetType(), this.Title, "alert('请输入时间!');", true);

15.easyUI jquery框架

16.css如何让表格文字顶格
   vertical-align: text-top;

17.linq批量操作 sql 区别
   for循环
   DAL层:尽量只写数据库操作、BLL层写对数据的逻辑操作

18.js:confirm("确认删除");

19. $("#form1").attr("action", "AuctionList.aspx");

20. <asp:HiddenField ID="datetime1" runat="server" />

21.CommandArgument

22.金钱的转换 tostring

23.页面之间值的传递的方法asp.net 和 html

24.href="javascript:void(0);"

25.checkdouble()

26.this.Base_PaiDang.Items.Insert(0, new ListItem("请选择排挡", ""));

27.this 本页面

28. Response.Write("<script>alert('用户信息错误!');location='login.aspx';</script>");

29.linq数据库查询.Any() empty

30.js判断是否有元素

31.div relative最外层 盖住其他层

32.google

33.dropdownlist SelectedValue

34.window.close();   js关闭

35.DropDownList 赋值

36.ASP.NET打开新页面而不关闭原来的页面

37.gridview样式

38.GridView自动编号

39.c# gridview dataformatstring

40.背景层

41.分页 listview:
   <asp:DataPager ID="dpActivity" runat="server" PagedControlID="lvInPicture" PageSize="4">
    <Fields>
     <asp:NextPreviousPagerField ButtonType=Link ShowFirstPageButton="True" ShowNextPageButton="False"
      ShowPreviousPageButton="False" />
     <asp:NumericPagerField />
     <asp:NextPreviousPagerField ButtonType=Link ShowLastPageButton="True" ShowNextPageButton="False"
      ShowPreviousPageButton="False" />
    </Fields>
   </asp:DataPager>
   gridview:
  

42.firefox
   .input2{30px;height:21px;padding-top:4px;border:1px solid #d5d5d5;position:relative;*top:4px;}
@-moz-document url-prefix(){.input2{top:2px;}}

43.对象数组转换成list
BLLAuction bll_getVehiceByCode = new BLLAuction();
        AuctionVehicleInfo vehiceInfo = new AuctionVehicleInfo();
        List<AuctionVehicleInfo> listVehiceInfo = new List<AuctionVehicleInfo>();
        vehiceInfo =bll_getVehiceByCode.GetaVehicleByCode(rq_vehiclecode);
        listVehiceInfo.Add(vehiceInfo);

44.CSS高度
   网页可见区域宽:document.body.clientWidth
网页可见区域高:document.body.clientHeight
网页可见区域宽:document.body.offsetWidth (包括边线的宽)
网页可见区域高:document.body.offsetHeight (包括边线的宽)
网页正文全文宽:document.body.scrollWidth
网页正文全文高:document.body.scrollHeight
网页被卷去的高:document.body.scrollTop
网页被卷去的左:document.body.scrollLeft
网页正文部分上:window.screenTop
网页正文部分左:window.screenLeft
屏幕分辨率的高:window.screen.height
屏幕分辨率的宽:window.screen.width
屏幕可用工作区高度:window.screen.availHeight
屏幕可用工作区宽度:window.screen.availWidth


HTML精确定位:scrollLeft,scrollWidth,clientWidth,offsetWidth
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetLeft:获取对象相对于版面或由 offsetParent 属性指定的父坐标的计算左侧位置
offsetTop:获取对象相对于版面或由 offsetTop 属性指定的父坐标的计算顶端位置
event.clientX 相对文档的水平座标
event.clientY 相对文档的垂直座标
event.offsetX 相对容器的水平坐标
event.offsetY 相对容器的垂直坐标
document.documentElement.scrollTop 垂直方向滚动的值
event.clientX+document.documentElement.scrollTop 相对文档的水平座标+垂直方向滚动的量

IE,FireFox 差异如下:

IE6.0、FF1.06+:

clientWidth = width + padding

clientHeight = height + padding

offsetWidth = width + padding + border

offsetHeight = height + padding + border

IE5.0/5.5:
clientWidth = width - border

clientHeight = height - border

offsetWidth = width

offsetHeight = height

(需要提一下:CSS中的margin属性,与clientWidth、offsetWidth、clientHeight、offsetHeight均无关)

45.解决弹出对话框页面变形
  解决的办法1

Page.RegisterClientScriptBlock("a", "<script>alert('已拒绝 " + lb_name.Text + " 的申请');window.open('EntMemberReview.aspx','fram_src');</script>");

解决方法2

//弹出对话框页面不变形,在.cs中写
RegisterClientScriptBlock("", "<script>alert('弹出')</script>");

也可用地下这个办法解决

Response.Write("<script language=javascript>alert('OK!');location='login.aspx';</script>");

46.怎么从后台改css
  lb_bid.ForeColor = System.Drawing.Color.FromName("#dc5211");
  lb_bid.Font.Size = FontUnit.Parse("22px");

47.js遍历input
    var tempInput = document.getElementsByTagName("input");
            for (i = 0; i < tempInput.length; i++) {
                if (tempInput[i].type == "text") {
                    tempInput[i].disabled = "disabled";
                }
                if (tempInput[i].type == "button") {
                    tempInput[i].disabled = "disabled";
                }
            }

48.window.open(html,'_self')

49.GridView分页

50.背景不滚动
   document.body.onmousewheel = function () { return false; }

51.获取滚动的高度
   document.documentElement.scrollTop + document.body.scrollTop

52.preventDefault()

53.全屏布局
  html,body{height:100%;}

54.label设置宽度
   display:-moz-inline-box;
  display:inline-block;

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