在aspx文件里面怎么定义datagrid属性,使得datagrid不换行?这里有提到使它不换行的方法,但是不适合我:
http://blog.csdn.net/net_lover/archive/2004/06/27/27689.aspx
//对于没有数字的内容,下面这行完全满足要求,但加了数字就不行,必须调用OnItemDataBound
ItemsGrid.Attributes.Add("style","word-break:keep-all;word-wrap:normal");
//下面这行是自动换行
//ItemsGrid.Attributes.Add("style","word-break:break-all;word-wrap:break-word");
我只能够修改aspx文件来达到我的目的。该怎么办?我尝试想这样指定属性:
<asp:ButtonColumn Text="删除" CommandName="Delete" ItemStyle="word-break:keep-all;word-wrap:normal"></asp:ButtonColumn>
结果报错:
分析器错误信息: “ItemStyle”属性是只读的,不能进行设置。help
http://blog.csdn.net/net_lover/archive/2004/06/27/27689.aspx
//对于没有数字的内容,下面这行完全满足要求,但加了数字就不行,必须调用OnItemDataBound
ItemsGrid.Attributes.Add("style","word-break:keep-all;word-wrap:normal");
//下面这行是自动换行
//ItemsGrid.Attributes.Add("style","word-break:break-all;word-wrap:break-word");
我只能够修改aspx文件来达到我的目的。该怎么办?我尝试想这样指定属性:
<asp:ButtonColumn Text="删除" CommandName="Delete" ItemStyle="word-break:keep-all;word-wrap:normal"></asp:ButtonColumn>
结果报错:
分析器错误信息: “ItemStyle”属性是只读的,不能进行设置。help
解决方案 »
- 如何在gridview的每条数据后面加一个确认已阅读键?
- 网站被注入了太多javascript
- 请问NHibernate里,many-to-many关联后的表,怎样实现事务增加,更改???
- 最新IP库
- SQLSERVER.NET数据提供程序可以连接到使用SQLSERVER6.5的服务器上吗?
- ======= 请问,DataGrid如何存盘 ===========
- 关于梅花雪日历控件问题
- 初学者的一个有关asp.net调试问题~~~
- 我想请问一下,当panel显示时如果下面有<select >控件是,这个控件不被盖住,结果好象panel破了下一样,请问题怎么办!谢谢
- 如何实现datagrid的编辑、删除功能
- 请教关于流媒体的问题
- 怎样显示数据???
<asp:ButtonColumn Text="删除" CommandName="Delete" ItemStyle="word-break:keep-all;word-wrap:normal"></asp:ButtonColumn>
加上<ItemStyle...>标记:
<asp:ButtonColumn Text="删除" CommandName="Delete" >
<ItemStyle Wrap="False"></ItemStyle>
</asp:ButtonColumn>
{
if ( e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item || e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem )
{
for(int i=0;i<10;i++)//i<列数
e.Item.Cells[i].Attributes.Add("nowrap","true");
}
http://dotnet.aspx.cc/ShowDetail.aspx?id=A27CA611-2DE7-432D-8DBC-1512CEFDAA53