0

Is there a way to "align" columns in a data repeater control?

I.E currently it looks like this:

user1 - colA colB colC colD colE
user2 - colD colE

I want it to look like:

  user1
   -colA
   -colB
   -colC
   -colD
   -colE


   user1



   -colD
   -colE

I need to columns for each record to align properly when additional records might not have data for a given column.

The requirements call for a repeater and not a grid control.

Any ideas?

Matt
  • 14,906
  • 27
  • 99
  • 149

3 Answers3

2

If you have access to how many columns are mising in the repeat, then just the following as the table tag. I you don't have access to this, can you post the source for your data repeater and what DataSource you're going against?

<td colspan='<%# MissingCount(Contatiner.DataItem) %>'>
Nick Craver
  • 623,446
  • 136
  • 1,297
  • 1,155
1

I would suggest that instead of using <td> to define the columns, that you use CSS instead.

.collink {
  width: 20px; 
  float: left; 
  height: 20px;
}

AND

<td style="padding :0px 0px 0px 0px;">
    <div class="collink">
        <asp:LinkButton ID="lnkEdit" runat="server" ... />
    </div>
</td>

This approach lets the content grow without actually affecting the table structure.

Jason Plank
  • 2,336
  • 5
  • 31
  • 40
Wayne
  • 38,646
  • 4
  • 37
  • 49
0

    <tr class="RadGridItem">
        <td width="100">
            <asp:Label ID="lblFullName" runat="server" 
                Text ='<%# DataBinder.Eval(Container.DataItem, "FullName") %>'
                ToolTip='<%# "Current Grade: " + DataBinder.Eval(Container.DataItem,"CurrentGrade") + "%" +
                             " Percent Complete: " + DataBinder.Eval(Container.DataItem,"PercentComplete") + "%" %>' />
        </td>
        <asp:Repeater ID="rptAssessments" runat="server" DataSource='<%# DataBinder.Eval(Container.DataItem, "EnrollmentAssessments") %>'>
            <ItemTemplate>
              <td style="padding :0px 0px 0px 0px; width:20px; height: 20px;">
                    <asp:LinkButton ID="lnkEdit" runat="server"
                        OnClick="AssessmentClick" 
                        style=' <%# "color:" + this.GetAssessmentColor(Container.DataItem)  %>'
                        ToolTip='<%# DataBinder.Eval(Container.DataItem, "AssessmentName") + Environment.NewLine + 
                                        DataBinder.Eval(Container.DataItem, "EnrollmentAssessmentStateName") + "(" + 
                                        DataBinder.Eval(Container.DataItem, "PercentGradeDisplay") + "%) " + 
                                        GetPointsPossible(Container.DataItem) + " pts possible" %>'
                        CommandArgument='<%# DataBinder.Eval(Container.DataItem, "EnrollmentAssessmentID") %>'
                        Text='<%# this.GetAssessmentDisplay(Container.DataItem) %>' />
                </td>
            </ItemTemplate>
        </asp:Repeater>
    </tr>
</ItemTemplate>

This is the code. The number of columns will be dynamic based on the criteria used to generate the list.

Thanks.