Link to home
Start Free TrialLog in
Avatar of scm0sml
scm0sml

asked on

giving each row of my datalist a 'header'

I have a datalist and have set the repeatcolumsn property to 15.

Each 'item' consists of a table with 3 rows.

What I want is at the beginning of each row is to have a simliar table with a title displaying what each row represents, so basically need a 'header' at the beginning of each 'row' when i pass the 15 columns.

is this possible?

I have attached my datalist at present

<asp:DataList ID="dlCabins" Runat="server" RepeatDirection="horizontal" RepeatColumns="15">
                                    <HeaderTemplate>   
                                        <br /> 
                                            <b><% =TranslateMe("Ensure you save any changes before hiding these cabins") %>.</b>
                                            <br /><br />                                                     
                                            </HeaderTemplate>
                                            
                                            <ItemTemplate>
                                      
                                                <table border="0" cellpadding="0" cellspacing="0" style="border: solid 1px black; text-align:center;">                                                     
                                                    <tr>
                                                        
                                                    <td>
                                                        <input type="hidden" runat="server" id="hddncabinid" value='<%# Container.Dataitem().CruiseCabin_ID %>' />
                                                        <table border="0" cellpadding="0" cellspacing="0" style="text-align:center;">                                                           
                                                            <tr class="DeckTableRow">
                                                                <td style="height:15px; text-align:center; width:100%">
                                                                    <i><%# Container.ItemIndex + 1 %></i>
                                                                </td>
                                                            </tr>
                                                            <tr>                                                           
                                                                <td style="height:30px; width:35px">
                                                                    <asp:TextBox runat="server" width="30px" ID="txtCabinNo" Text='<%# Container.Dataitem().CabinNumber %>'></asp:TextBox>                                                       
                                                                </td>    
                                                            </tr>
                                                            <tr class="DeckTableRow">
                                                                <td style="height:30px; text-align:center; width:100%">
                                                                    <asp:Label ID="lblPriority"  runat="server" Text='<%# Container.Dataitem().Priority %>'></asp:Label>                                                                    
                                                                </td> 
                                                            </tr>
                                                        </table>
                                                    </td>                                                                                            
                                            </ItemTemplate>
                                            <FooterTemplate>
                                                    </tr>
                                                </table>
                                            </FooterTemplate>
                                </asp:DataList>

Open in new window

Avatar of scm0sml
scm0sml

ASKER

This is the cell that i need at the beginning of each 'row':
<td>
                                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" style="text-align:center;">
                                                                <tr class="DeckTableRow">
                                                                    <td style="height:15px">
                                                                        &#160;
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td style="height:30px">
                                                                        <b>No</b>
                                                                    </td>
                                                                </tr>
                                                                <tr class="DeckTableRow">
                                                                    <td style="height:30px">
                                                                        <b>Pr</b>
                                                                    </td>
                                                                </tr>                                                                                                                                                                                                                                                            
                                                            </table>                                                    
                                                        </td>      
Avatar of scm0sml

ASKER

I have now amended the datalist slightly and attached, this gives me the titles for each item whereas i only want it for each row.
<asp:DataList ID="dlCabins" Runat="server" RepeatDirection="horizontal" RepeatColumns="15">
                                    <HeaderTemplate>   
                                        <br /> 
                                            <b><% =TranslateMe("Ensure you save any changes before hiding these cabins") %>.</b>
                                            <br /><br />                                                     
                                            </HeaderTemplate>
                                            
                                            <ItemTemplate>
                                      
                                              
                                                        <td>
                                                            <table border="0" cellpadding="0" cellspacing="0" width="100%" style="text-align:center;">
                                                                <tr class="DeckTableRow">
                                                                    <td style="height:15px">
                                                                        &#160;
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td style="height:30px">
                                                                        <b>No</b>
                                                                    </td>
                                                                </tr>
                                                                <tr class="DeckTableRow">
                                                                    <td style="height:30px">
                                                                        <b>Pr</b>
                                                                    </td>
                                                                </tr>                                                                                                                                                                                                                                                            
                                                            </table>                                                    
                                                        </td>       
                                                    <td>
                                                        <input type="hidden" runat="server" id="hddncabinid" value='<%# Container.Dataitem().CruiseCabin_ID %>' />
                                                        <table border="0" cellpadding="0" cellspacing="0" style="text-align:center;">                                                           
                                                            <tr class="DeckTableRow">
                                                                <td style="height:15px; text-align:center; width:100%">
                                                                    <i><%# Container.ItemIndex + 1 %></i>
                                                                </td>
                                                            </tr>
                                                            <tr>                                                           
                                                                <td style="height:30px; width:35px">
                                                                    <asp:TextBox runat="server" width="30px" ID="txtCabinNo" Text='<%# Container.Dataitem().CabinNumber %>'></asp:TextBox>                                                       
                                                                </td>    
                                                            </tr>
                                                            <tr class="DeckTableRow">
                                                                <td style="height:30px; text-align:center; width:100%">
                                                                    <asp:Label ID="lblPriority"  runat="server" Text='<%# Container.Dataitem().Priority %>'></asp:Label>                                                                    
                                                                </td> 
                                                            </tr>
                                                        </table>
                                                    </td>                                                                                            
                                            </ItemTemplate>
                                            <FooterTemplate/>
                                </asp:DataList> 

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of scm0sml

ASKER

perfect thanks for that!!
Welcome !! :)