Avoiding empty cells in a DataList

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default Avoiding empty cells in a DataList

    I have a DataList with a RepeatColumns property that has a value of 3.
    However, when the number of items is not divisible by 3, I have blank cells
    at the end of the list, which makes the DataList look somewhat ugly. Is
    there a way to avoid this? Thanks.

    I also use an AlternatingItemTemplate with a different BackColor property
    than my ItemTemplate. However, depending on the number of items my DataList
    might end up looking like a checkerboard if the first itemtype in each
    column is different. Is there some way to "reset" the itemtype for each
    column? I would rather not need to set the BackColor manually for each item
    using the ItemDataBound event. Thanks.
    --
    Nathan Sokalski
    [email]njsokalski@hotmail.com[/email]
    [url]http://www.nathansokalski.com/[/url]


    Nathan Sokalski Guest

  2. Similar Questions and Discussions

    1. An adding template for an empty datagrid/ datalist
      When a SQL query returns 0 results. I can not use the editItemTemplate to add a new record in to the table. Is there anyway to use these...
    2. #26380 [Opn]: empty($SimpleXMLObject) doesn't return true when empty
      ID: 26380 User updated by: bart at mediawave dot nl -Summary: Find out whether an object is empty Reported By: bart...
    3. #25885 [Opn->Csd]: mail() causes apache2 to crash when message is empty, and headers is non-empty
      ID: 25885 Updated by: sniper@php.net Reported By: ben at krackeler dot com -Status: Open +Status: ...
    4. #25885 [NEW]: mail() causes apache2 to crash when message is empty, and headers is non-empty
      From: ben at krackeler dot com Operating system: WinXP PHP version: 4.3.3 PHP Bug Type: Mail related Bug description: ...
    5. Cells[].Text or Cells[].Controls[0]
      Folks, The following code illustrates two methods of obtaining the contents of a DataGrid Item. The function has been bound to the ItemCommand of...
  3. #2

    Default Re: Avoiding empty cells in a DataList

    Don't use AlternatingItemTemplate. Rather use PreRender event to loop
    through the items and set their BackColor depending on the item position in
    the row.

    Eliyahu

    "Nathan Sokalski" <njsokalski@hotmail.com> wrote in message
    news:%23L7GQwuvFHA.3452@TK2MSFTNGP14.phx.gbl...
    > I have a DataList with a RepeatColumns property that has a value of 3.
    > However, when the number of items is not divisible by 3, I have blank
    cells
    > at the end of the list, which makes the DataList look somewhat ugly. Is
    > there a way to avoid this? Thanks.
    >
    > I also use an AlternatingItemTemplate with a different BackColor property
    > than my ItemTemplate. However, depending on the number of items my
    DataList
    > might end up looking like a checkerboard if the first itemtype in each
    > column is different. Is there some way to "reset" the itemtype for each
    > column? I would rather not need to set the BackColor manually for each
    item
    > using the ItemDataBound event. Thanks.
    > --
    > Nathan Sokalski
    > [email]njsokalski@hotmail.com[/email]
    > [url]http://www.nathansokalski.com/[/url]
    >
    >

    Eliyahu Goldin Guest

Posting Permissions

  • You may not post new threads
  • You may 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