Table design Nested datalist

I am using the codes below to see a result like picture 1, but a result like picture 2 is getting closer. What needs to be done to solve it?

aspx code:

<asp:datalist id="dtlUrun" runat="server" RepeatDirection="Horizontal">
            <ItemTemplate>
                <table class="dtlTable">
                    <tr>
                        <td class="dtlHeader"></td>
                        <td class="dtlHeader"><%#DataBinder.Eval(Container.DataItem, "DS_MAMUL")%></td>
                    </tr>
                    <asp:DataList ID="dtlBayi" Runat="server">
                        <ItemTemplate>
                            <tr>
                                <td class="dtlColumn"><%#DataBinder.Eval(Container.DataItem, "DS_BAYI")%></td>
                                <td class="dtlColumn"><%#DataBinder.Eval(Container.DataItem, "MT_MIKTAR")%></td>
                            </tr>
                        </ItemTemplate>
                    </asp:DataList>
                </table>
            </ItemTemplate>
        </asp:datalist>

      

Style:

    <style type="text/css">

.dtlTable {
    BORDER-RIGHT: #000000 1px solid; 
    BORDER-TOP: #000000 1px solid; 
    BORDER-LEFT: #000000 1px solid; 
    BORDER-BOTTOM: #000000 1px solid; 
    BORDER-COLLAPSE: collapse; 
    BACKGROUND-COLOR: #fafafa; 
    border-spacing: 0px;
}
.dtlColumn {
    PADDING-RIGHT: 0px; 
    PADDING-LEFT: 8px; 
    FONT-WEIGHT: normal; 
    FONT-SIZE: 0.7em; 
    PADDING-BOTTOM: 4px; 
    COLOR: #404040; 
    PADDING-TOP: 4px; 
    BORDER-BOTTOM: #6699cc 1px dotted; 
    FONT-FAMILY: Verdana, sans-serif, Arial; 
    BACKGROUND-COLOR: #fafafa; 
    TEXT-ALIGN: left;
}
.dtlHeader {
    BORDER-RIGHT: #000000 1px solid; 
    BORDER-TOP: #000000 1px solid; 
    FONT-WEIGHT: bold; 
    FONT-SIZE: 12px; 
    BORDER-LEFT: #000000 1px solid; 
    COLOR: #404040; 
    BORDER-BOTTOM: #000000 1px solid; 
    FONT-FAMILY: Verdana; 
    BACKGROUND-COLOR: #99cccc;
} 

    </script>

      

vb Code:

Private Sub bindGrid()
    Dim objUrun As New caynet_class.cls_LU_MAMUL
    Me.dtlUrun.DataSource = objUrun.GetBy_MAMUL_ARALIGI(Session("CAY_NEVILERI_SATIS_KRITER")("MAMUL_NO1"), Session("CAY_NEVILERI_SATIS_KRITER")("MAMUL_NO2"))
    Me.dtlUrun.DataBind()
End Sub

Private Sub dtlUrun_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dtlUrun.ItemDataBound
    If Not e.Item.ItemIndex = -1 Then
        Dim mamulNo As Integer = CType(DataBinder.Eval(e.Item.DataItem, "MAMUL_NO"), Integer)
        CType(e.Item.FindControl("dtlBayi"), DataList).DataSource = caynet_class.cls_RAPOR_SATIS.Get_Cay_Nevileri_Satis2(mamulNo)
        CType(e.Item.FindControl("dtlBayi"), DataList).DataBind()
        Session("dtlDurum") = False
    End If
End Sub

      

Image 1: http://img146.imageshack.us/my.php?image=89632085xz4.jpg

Picture2: http://img227.imageshack.us/my.php?image=15383944jq6.jpg

+1


source to share


2 answers


From what I can tell in the code, the first datalist is linked to two header elements and then inside that you have separate elements. Your template creates a table for each section, but by default the tables will be block level elements. I assume you can fix this with CSS, but I will need to check. I personally would do something like this.

<asp:dataList id="" runat="server">
    <headertemplate>
        <table>
            <tr>
    </headertemplate>
    <itemtemplate>
        <td>
            <!-- Your template here -->
        </td>
    </itemtemplate>
    <footertemplate>
        </tr></table>
    </footertemplate>
</asp:datalist>

      



This essentially puts two tables inside the cells of a large table within your datalist.

+2


source


Tag

in headartemplate cannot see its closing tag in footertemplate. Are you sure your code is correct?

You said:



I guess you can fix this with CSS

Please fix it with Css :)

0


source







All Articles