GridView에서 너비 이상의 문자 자르기

999 단어 GridView
방법 1:★css 처리:
a

{

 width: 80px;

 overflow: hidden; /*         */

 white-space: nowrap;

 -o-text-overflow: ellipsis;

 text-overflow: ellipsis;

}

a:hover

{

 text-decoration: none;

 color: #000;

}


<%#Eval("GlobalCode")%>
방법2:★서버측 문자 캡처
GridViewTicket에서RowDataBound 등의 이벤트
string hotelAddress = dtHotel.Rows[row.RowIndex]["hotel_address"].ToString().Trim();

if (hotelAddress.Length > 9)

{

       ((Label)row.FindControl("LabelHotelAddress")).Text = hotelAddress.Substring(0, 8) + "...";

       ((Label)row.FindControl("LabelHotelAddress")).ToolTip = hotelAddress;

 }

else

{

       ((Label)row.FindControl("LabelHotelAddress")).Text = hotelAddress;

        ((Label)row.FindControl("LabelHotelAddress")).ToolTip = hotelAddress;

}



좋은 웹페이지 즐겨찾기