How do I control the contents of a DataGrid to wrap and not to change lines?
Source: Internet
Author: User
Datagrid| control Demand Strange, some requirements form the content of automatic line, some do not require, in fact, set the DataGrid CSS style single property can achieve most of the requirements, but for the implementation of the line, the style sheet can not fully meet the requirements, the following is a way to solve:
Dt. Columns.Add (New DataColumn ("IntegerValue", typeof (Int32));
Dt. Columns.Add (New DataColumn ("StringValue", typeof (String));
Dt. Columns.Add (New DataColumn ("Currencyvalue", typeof (Double));
for (int i = Start_index i < Start_index + itemsgrid.pagesize; i++)
{
Dr = dt. NewRow ();
Dr[0] = i;
DR[1] = @ "I am Chinese text, I am English words, I do not want to change lines,
I don ' t wanna have new lines, Welcome to visit
<a href= ' http://dotnet.aspx.cc/' >http://dotnet.aspx.cc/</a>
Have good material AH:) ";
DR[2] = 1.23 * (i+1);
Dt. Rows.Add (DR);
}
DataView dv = new DataView (DT);
return DV;
}
void Page_Load (Object sender, EventArgs e)
{
For content without numbers, the following line fully satisfies the requirements, but not with the addition of numbers, you must call Onitemdatabound
ITEMSGRID.ATTRIBUTES.ADD ("Style", "word-break:keep-all;word-wrap:normal");
The following line is a wrap line
ITEMSGRID.ATTRIBUTES.ADD ("Style", "Word-break:break-all;word-wrap:break-word");
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service