博文

目前显示的是 六月, 2008的博文

作品被51aspx收录了,HOH~

图片
相关介绍: http://www.51aspx.com/CV/MVCBlog/ 不枉费我花费了一个多星期的时间啊。~ 赞一下自己,

取消gridview的头部

把showheader属性设置为false 看来,gridview的好多属性还是很管用的,自己还很不了解。

关于对PagedDataSource的相关操作,引起的思考和实践

在这次的课程设计中,文章的分类为int,在显示的时候需要根据这个数到另一个表中去查找相应的类别名称,我当时图省事,向在blog.aspx页面下面搞点手脚,可是不能将EVAL("")用于非字段绑定的上下文中,最后,突然想到了,pageddatasource的数据源实际上我是给了一个list类,所以实际上,可以在数据访问层,再查询一次数据库,因此在Article类中加入了leibiestr,然后在读取的时候,重新到leibietable中再读一次值,具体的代码可以看看:呵呵, 新加入了leibie类,和leibieoperater类,下面的黑体字是新加入的代码!---有思路就有出路,拽拽!! public List<Article> viewAll()     {         List<Article> list = new List<Article>();         con.Open();         cmd = new SqlCommand("select * from newstable order by time desc", con);         SqlDataReader sdr = cmd.ExecuteReader();         Article ac;          Leibie lb = null;         LeibieOperater lbo = null;         while (sdr.Read())         {              lb = new Leibie();             lbo = new LeibieOperater();             ac = new Article();             ac.id= sdr["id"].ToString();             ac.liebie =Convert.ToInt32(sdr["leibie"]);              int i = ac.liebie;             lb = lbo.getbyid(i);     

eval()与bind()区别

首先 Eval()是可以单独使用,而Bind()必须放在某一个控件的属性下面,当用Gridview的时候,一般都是Bind() 其他的不同之处,偶还没有发觉,欢迎跟帖讨论,Hoho

用gridview需要注意的几点问题

You can take advantage of the <%@ Page %> directive's MaintainScrollPositionOnPostback attribute to scroll a page back automatically to the same position whenever the page is posted back to the server. For example, if you add this attribute and click an Edit link rendered by a GridView , the page automatically scrolls to the record being edited. This attribute works with Internet Explorer 6+, Firefox 1+, and Opera 8+. When you click an Edit link, you can edit a particular database row. The GridView automatically renders a check box for any Boolean columns and a text field for any other type of column. The GridView control does not support inserting new records into a database table. If you need to insert new records, use either the DetailsView or FormView control. Furthermore, notice that the GridView control includes a DataKeyNames property . When editing and deleting rows with the GridView , you need to assign the name of the primary key field from the database tabl

javascript 限制图片大小[ 帅!]

一般用于文章查看的页面 , 针对新闻性质的网站 , 此外这个算法是直接分析网页中所有图片的 , 因此如果你的版面设计中有比指定宽度大的图片是不能用这个函数的 ( 或者用 id 区分开 ) <script language="javascript"> function ResizeImages() {    var myimg,oldwidth;    var maxwidth=600;    for(i=0;i<document.images.length;i++) {      myimg = document.images[i];       if(myimg.width > maxwidth)      {         oldwidth = myimg.width;          myimg.width = maxwidth;          myimg.height = myimg.height * (maxwidth/oldwidth);      }     } } ResizeImages(); </script>

n个进程共享m个资源得死锁问题证明

         n个进程共享M个资源,每个进程一次只能申请/释放一个资源,每个进程最多需要M个资源,所有进程总共的资源需求少于M+N个,证明该系统此时不会产生死锁。 答:设max (i)表示第i个进程的最大资源需求量,need(i)表示第i个进程还需要的资源量,alloc(i)表示第i个进程已分配的资源量。由题中所给条件可知:       max(1)+┅+max(n)=(need(1)+┅+need(n))+((alloc(1)+┅+alloc(n))<m+n 如果在这个系统中发生了死锁,那么一方面m个资源应该全部分配出去,       alloc(1)+ ┅+alloc(n)=m 另一方面所有进程将陷入无限等待状态。可以推出       need(1)+ ┅+need(n)<n 上式表示死锁发生后,n个进程还需要的资源量之和小于n, 这意味着此刻至少存在一个进程i,need(i)=0 ,即它已获得了所需要的全部资源。既然该进程已获得了它所需要的全部资源,那么它就能执行完成并释放它占有的资源,这与前面的假设矛盾,从而证明在这个系统中不可能发生死锁。