Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Add Attribute to <TD>

Reply
Thread Tools

Add Attribute to <TD>

 
 
J Holsinger
Guest
Posts: n/a
 
      01-04-2005
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


 
Reply With Quote
 
 
 
 
J Holsinger
Guest
Posts: n/a
 
      01-04-2005
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation (XHTML 1.0 Transitional): Attribute 'leftmargin' is not a valid attribute of element 'body'. anonymous ASP .Net 1 08-02-2006 08:05 AM
picking value of one attribute based on a child elements attribute? XPath? vjethava@gmail.com XML 2 03-06-2006 05:19 AM
Implied instance attribute creation when referencing a class attribute Russell Warren Python 5 01-17-2006 05:07 AM
XSLT: Making attribute to parent attribute Bostonasian XML 1 09-18-2005 07:30 AM
class attribute to instance attribute Donnal Walter Python 4 07-06-2005 04:35 AM



Advertisments