如何包装文字在GridView的绑定列列 [英] how to wrap text in boundfield column in gridview

查看:130
本文介绍了如何包装文字在GridView的绑定列列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个BoundField列并在该列中,如果我长15输入的字符串(无空格),是没有问题的。但是,如果字符串超过15个,文本不换行。我给了命令column.ItemStyle.Wrap = TRUE;但它不工作。我有固定的列的宽度。

i am having a boundfield column and in that column if i entered a string(without spaces) of length 15, there is no problem. But if the string is more than 15, the text is not wrapped. I gave the command column.ItemStyle.Wrap=true; But its not working. I have fixed the width of the column.

如何包装在绑定列,如果多串15个字符的文本。
谢谢

How to wrap the text in the boundfield if a string more 15 characters. Thanks

推荐答案

对不起,我的previous解决方案。

Sorry, for my previous solution.

您可以使用< BR /方式> 来打破各15个字符

You could use <br/> to break for each 15 characters.

例如,如果你的字符串结果是 1234567890123456 。它不见了为 123456789012345&LT; BR /&GT; 6

Example if you string result is 1234567890123456. It gone be 123456789012345<br/>6

下面的一些片段code:

Here some snippets code:

string myString = "mondayfridaysaturday";
string result = string.Empty;
for (int i=0; i<myString.Length; i++)
    result += (i%14==0&&i!=0) ? (myString[i].ToString()+"<br/>") : myString[i].ToString();

这篇关于如何包装文字在GridView的绑定列列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆