Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   Add Attribute to <TD> (http://www.velocityreviews.com/forums/t761456-add-attribute-to-td.html)

J Holsinger 01-04-2005 10:02 PM

Add Attribute to <TD>
 
Does anybody know how to add the html 'nowrap' attribute to a particular
column in a datagrid?

This doesn't work, because I suspect the attributes are readonly at this
point:
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound
Dim Cell As TableCell = e.Item.Cells(3)
Cell.Wrap = True

'Cell.Attributes("nowrap") = "nowrap"
'Dim myHttpResponse As HttpResponse = Response
'Dim myHtmlTextWriter As New HtmlTextWriter(myHttpResponse.Output)
'Cell.Attributes.AddAttributes(myHtmlTextWriter)
End Sub

--

thx
-jsh



J Holsinger 01-04-2005 11:49 PM

Re: Add Attribute to <TD>
 
Figured it out. What my intent was to turn on word wrapping, which was
confused in my original post.
I used the following and I got what I wanted.

<head>
<style type="text/css">
<!--
.col_break{
vertical-align:top;
word-wrap:break-word;
width:30%;}
//-->
</style>
</head>
<body ms_positioning="GridLayout">
<asp:datagrid id="DataGrid1" runat="server"
allowsorting="true"
onsortcommand="DataGrid1_Sort"
autogeneratecolumns="False"
width="100%">
<columns>
<asp:boundcolumn
headertext="Description"
datafield="description"
sortexpression="description"
itemstyle-cssclass="col_description">
</asp:boundcolumn>
</columns>
</asp:datagrid>
</body>
</html>

--

thx
-jsh




All times are GMT. The time now is 03:50 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.