zoukankan      html  css  js  c++  java
  • .net常用的部分

    删除按钮的提示:
    if (e.Item.ItemType==ListItemType.Item || e.Item.ItemType==ListItemType.AlternatingItem)
    {
     Button btnDele = (Button)e.Item.Cells[9].Controls[1];
     btnDele.Attributes.Add("onclick","javascript:return confirm('确实要删除 "+e.Item.Cells[0].Text+"');");
    }


    鼠标移到DataGrid控件的某一行改变行的背景:ItemDataBound事件写:
    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    {
     e.Item.Attributes.Add("onmouseover","currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
     e.Item.Attributes.Add("onmouseout","this.style.backgroundColor=currentcolor");
    }


    在第一列上添加自动编号
    if (e.Item.ItemIndex != -1)
    {
     e.Item.Cells[0].Text = (e.Item.ItemIndex+1).ToString();
    }

    在.NET的HTML页面中引用命名空间:<%@ Import Namespace="_9fbank.PrivateSchool"%>
    另一个页面得到字符串:
    1、Request[""].ToString();
    2、Request.QueryString[""].ToString();

    绑定数据:
    DataBinder.Eval(Container.DataItem,"数据字段","格式");DataBinder.Eval(Container.DataItem,"数据字段","格式");
    日期格式:"{0:yyyy-MM-dd HH:mm:ss}"
    图片格式:"../Image/{0}.gif"

    ((DataRowView)e.Item.DataItem)["ArticleID"].ToString();=Eval("AtricleID");


    DataGrid 超链接:
    文本字段:绑定的DB字段
    URL字段:变量的DB字段
    URL格式字符串:地址?变量={0} 或者 "javascript:var win=window.open('WebForm2.aspx',null,'width=300,height=200');window.close();"
                                        window.close();//关闭WebForm1.aspx


    获得网页的原代码:
    System.Uri URL=new Uri(@"http://yaei.gov.cn/yachem/UserList.asp?OrderType=2&page="+i.ToString());
         System.Net.HttpWebRequest quest=(System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(URL);
        System.Net.HttpWebResponse sponse =(System.Net.HttpWebResponse)quest.GetResponse();

        StreamReader reader=new StreamReader(sponse.GetResponseStream(),Encoding.GetEncoding("GB2312"));

       
        string str;
        str=reader.ReadToEnd();
        //str.GetType();
        //Response.Write(str.GetType());
        StreamWriter sw=File.CreateText(@"E:\huaxue\yaanhuaxue"+i+".txt");

                    sw.Write(str);
        Response.Write(" "+i+" ");

  • 相关阅读:
    开发日记1
    探索需求2
    探索需求1
    周总结8
    周总结7
    周总结6
    周总结5
    周总结4
    周总结3
    周总结2
  • 原文地址:https://www.cnblogs.com/pretty/p/1276618.html
Copyright © 2011-2022 走看看