By combining these controls, you can easily set up master-detail views using very little code and sometimes no code at all. From the following chapters you can see some important operations in ASP. Page前台主要代码: On Row Updating="Grid View1_Row Updating" On Row Canceling Edit="Grid View1_Row Canceling Edit" Back Color="White" Border Color="#CCCCCC" Border Style="None" Border Width="1px" Font-Size="12px" On Row Data Bound="Grid View1_Row Data Bound"gridview里有一列绑定的数据很长,显示的时候在一行里面显示,页面拉得很宽。原因是连续英文段为一个整体导致的,在Row Data Bound中添加上了一句e. Add("word-break", "break-all")就可以。如果要给所有的列增加此属性: protected void Page_Load(object sender, Event Args e) 总之:善用CSS的,不同于网上其他方式,我觉得用一个Check Box更人性化,这样可以隐藏不必要的列,让用户自己选择需要出现的列,在处理多列时这是一个很好的解决方案!效果图:图1-开始图2-点击显示的Check Box后解决方案:public void bind() 双击Check Box1,在Checked Changed方法里写上代码,最后代码如下:protected void Check Box1_Checked Changed(object sender, Event Args e) 注意:Check Box1的!后台全部代码如下:using System;using System. For this demo application, I have taken a very simple example. 1) Fix for the code block For the css 'pre', add new property 'min-width: 730px;' and add width nn percentage. I am assuming that I have to play with record of persons (First Name, Last Name, Age) and I will refer only these data through out this article. just to give you flexibility to not show scroll bar for long screens. The Grid View control is the successor to the Data Grid and extends it in a number of ways. With this Grid View control, you could display an entire collection of data, easily add sorting and paging, and perform inline editing.
|