0
이것은 메뉴 표제 길이 자르기 길이를 원하는 My Grid보기 코딩입니다. 이전 제가격자보기 열의 제한된 크기 (자른 문자열 길이)
동적 값을 설정하고 사용
<asp:BoundField DataField="MenuName" HeaderText="MenuName" TruncateLegnth="6" />
<asp:BoundField DataField="Url" HeaderText="Url" />
<asp:BoundField DataField="Tooltip" HeaderText="Tooltip" />
보호 공극 GridView1_RowDataBound (객체 송신자 GridViewRowEventArgs E) {INT의 I = 0;
if (e.Row.RowType == DataControlRowType.DataRow)
{
foreach (TableCell cell in e.Row.Cells)
{
i++;
string Word = cell.Text;
if (cell.Text.Length > 5 && (i == 1))
cell.Text = cell.Text.Substring(0, 5) + "....";
if (cell.Text.Length > 3 && (i == 3))
cell.Text = cell.Text.Substring(0, 3) + "....";
if (cell.Text.Length > 6 && (i == 2))
cell.Text = cell.Text.Substring(0, 6) + "....";
cell.ToolTip = Word;
}
}
}
이제 TruncateLegnth 기반 열이 필요합니다.