20151217JS便签

JS便签:
    根据一个数值来改变Repeater行数的颜色
        <script type="text/javascript">
        var query = document.getElementsByClassName("kc");
        for (var i = 0; i < query.length; i++) {
            var num = query[i];
            var k = query[i].innerText;
            if (k >= 20) {

            } 
            else {
                var hang = num.parentNode;
                hang.setAttribute("bgcolor", "#FF0033");
            }
        }
    </script>

添加成功:
Literal1.Text = "<script type='text/javascript'>alert('"+"添加成功"+"')</script>"


 模糊查询:
     string ids = TextBox1.Text;
        string name = TextBox2.Text;
        DataClassesDataContext context = new DataClassesDataContext();
        List<Fruit> list = context.Fruit.ToList();
        if (ids != "")
        {
            list = list.Where(r => r.Ids.Contains(ids)).ToList();
        }
        if (name != "")
        {
            list = list.Where(r => r.Name.Contains(name)).ToList();
        }
        Repeater1.DataSource = list;
        Repeater1.DataBind();

 

posted on 2016-01-02 19:07  路人甲zzz  阅读(146)  评论(0编辑  收藏  举报

导航