views:

822

answers:

3

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?

Thanks

+1  A: 

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
A: 

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

+1  A: 
Wayne