-- thx -jsh [allowsmilie] => 1 [showsignature] => 0 [ipaddress] => [iconid] => 0 [visible] => 1 [attach] => 0 [infraction] => 0 [reportthreadid] => 0 [isusenetpost] => 1 [msgid] => <#tTH8zn8EHA.936@TK2MSFTNGP12.phx.gbl> [ref] => [htmlstate] => on_nl2br [postusername] => J Holsinger [ip] => jsh02_nova@hotm [isdeleted] => 0 [usergroupid] => [membergroupids] => [displaygroupid] => [password] => [passworddate] => [email] => [styleid] => [parentemail] => [homepage] => [icq] => [aim] => [yahoo] => [msn] => [skype] => [showvbcode] => [showbirthday] => [usertitle] => [customtitle] => [joindate] => [daysprune] => [lastvisit] => [lastactivity] => [lastpost] => [lastpostid] => [posts] => [reputation] => [reputationlevelid] => [timezoneoffset] => [pmpopup] => [avatarid] => [avatarrevision] => [profilepicrevision] => [sigpicrevision] => [options] => [akvbghsfs_optionsfield] => [birthday] => [birthday_search] => [maxposts] => [startofweek] => [referrerid] => [languageid] => [emailstamp] => [threadedmode] => [autosubscribe] => [pmtotal] => [pmunread] => [salt] => [ipoints] => [infractions] => [warnings] => [infractiongroupids] => [infractiongroupid] => [adminoptions] => [profilevisits] => [friendcount] => [friendreqcount] => [vmunreadcount] => [vmmoderatedcount] => [socgroupinvitecount] => [socgroupreqcount] => [pcunreadcount] => [pcmoderatedcount] => [gmmoderatedcount] => [assetposthash] => [fbuserid] => [fbjoindate] => [fbname] => [logintype] => [fbaccesstoken] => [newrepcount] => [vbseo_likes_in] => [vbseo_likes_out] => [vbseo_likes_unread] => [temp] => [field1] => [field2] => [field3] => [field4] => [field5] => [subfolders] => [pmfolders] => [buddylist] => [ignorelist] => [signature] => [searchprefs] => [rank] => [icontitle] => [iconpath] => [avatarpath] => [hascustomavatar] => 0 [avatardateline] => [avwidth] => [avheight] => [edit_userid] => [edit_username] => [edit_dateline] => [edit_reason] => [hashistory] => [pagetext_html] => [hasimages] => [signatureparsed] => [sighasimages] => [sigpic] => [sigpicdateline] => [sigpicwidth] => [sigpicheight] => [postcount] => 2 [islastshown] => 1 [isfirstshown] => [attachments] => [allattachments] => ) --> Add Attribute to <TD> - ASP.NET Data Grid Control

Add Attribute to <TD> - ASP.NET Data Grid Control

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...

  1. #1

    Default 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 Guest

  2. #2

    Default 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


    J Holsinger Guest

Similar Threads

  1. Add attribute to tag
    By djc11 in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 0
    Last Post: January 22nd, 07:01 PM
  2. Retrive data from attribute spaced attribute.
    By kruse in forum Coldfusion Database Access
    Replies: 3
    Last Post: January 4th, 12:27 PM
  3. Replies: 3
    Last Post: June 29th, 02:00 PM
  4. SoapIgnore attribute ignored.
    By Benjamin Day in forum ASP.NET Web Services
    Replies: 2
    Last Post: September 9th, 02:39 AM
  5. Image Alt Attribute
    By topium in forum Web Design
    Replies: 2
    Last Post: September 26th, 01:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139