• 备忘录


    DPL规范:http://assets.taobaocdn.com/tbra/dpl/

    中文说明

    Math.Round() 四舍五入,Math.Floor()取整数。 Math.Ceiling() 取正整数。

    i.ToString().Trim().Substring(i.ToString().Trim().LastIndexOf(".")+1).ToLower().Trim() //获取" . "后面的字符

    Button1.Attributes.Add("onclick","return confirm('确认?')");//为按钮添加对话框
    button.Attributes.Add("onclick","if(confirm(’are you sure...?’)){return true;}else{return false;}")

    TableCell myTableCell = e.Item.Cells[14];

    myDeleteButton = (LinkButton)myTableCell.Controls[0];//寻找14列中的第一个LinkButton控件

    12345.ToString("n"); //生成 12,345.00
    12345.ToString("C"); //生成 ¥12,345.00
    12345.ToString("e"); //生成 1.234500e+004
    12345.ToString("f4"); //生成 12345.0000
    12345.ToString("x"); //生成 3039 (16进制)
    12345.ToString("p"); //生成 1,234,500.00%

    样式交替:

    ListItemType itemType = e.Item.ItemType;
    if (itemType == ListItemType.Item )
    {
    e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor=’#FFFFFF’;";
    e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor=’#d9ece1’;cursor=’hand’;" ;
    }
    else if( itemType == ListItemType.AlternatingItem)
    {
    e.Item.Attributes["onmouseout"] = "javascript:this.style.backgroundColor=’#a0d7c4’;";
    e.Item.Attributes["onmouseover"] = "javascript:this.style.backgroundColor=’#d9ece1’;cursor=’hand’;" ;
    }


     

    表格点击改变颜色

    if (e.Item.ItemType == ListItemType.Item ||e.Item.ItemType == ListItemType.AlternatingItem)
    {
    e.Item.Attributes.Add("onclick","this.style.backgroundColor='#99cc00';this.style.color='#99cc00';this.style.cursor='default';");

      e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='#99cc00';this.style.color='buttontext';this.style.cursor='default';");
    e.Item.Attributes.Add("onmouseout","this.style.backgroundColor='';this.style.color='';");

    }

    获取错误信息并到指定页面
    不要使用Response.Redirect,而应该使用Server.Transfer

    // in global.asax
    protected void Application_Error(Object sender, EventArgs e)

    {
    if (Server.GetLastError() is HttpUnhandledException)
    Server.Transfer("MyErrorPage.aspx");

    //其余的非HttpUnhandledException异常交给ASP.NET自己处理

    }

    Redirect会导致post-back的产生从而丢失了错误信息,所以页面导向应该直接在服务器端执行,这样就可以在错误处理页面得到出错信息并进行相应的处理

    <asp:panel style="overflow-x:scroll;overflow-y:auto;"></asp:panel>Panel 横向滚动,纵向自动扩展

    /// 服务器端弹出alert对话框,并使控件获得焦点
    /// </summary>
    /// <param name="str_Ctl_Name">获得焦点控件Id值,比如:txt_Name</param>
    /// <param name="str_Message">提示信息,例子:"请输入您姓名!"</param>
    /// <param name="page">Page类</param>
    public void Alert(string str_Ctl_Name,string str_Message,Page page)
    {
    page.RegisterStartupScript("","<script>alert('"+str_Message+"');document.forms(0)."+str_Ctl_Name+".focus(); document.forms(0)."+str_Ctl_Name+".select();</script>");
    }

    用Convert.IsDBNull绑定空值
    SelectedValue='<%# Convert.IsDBNull(Eval("提现方式"))?"请选择提现方式":Eval("提现方式") %>'

  • 相关阅读:
    使用canvas实现擦玻璃效果
    安装jdk For Windows
    墙裂推荐4款js网页烟花特效
    再次推荐一款逼真的HTML5下雪效果
    HTML5播放暂停音乐
    周末web前端练习
    Javascript贪食蛇小游戏
    jquery实现更多内容效果
    jQuery省市区三级联动插件
    Web前端测试题
  • 原文地址:https://www.cnblogs.com/0000/p/1593987.html
Copyright © 2020-2023  润新知