Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
I want to add the labels as header template & the static Dropdownlist in the Item template.
-> The labels will be created dynamically.
-> And Each Label should have DDL in the next row.
-> All Labels in 1st row & all DDLs in next row.

I tried with repeater, it was not working as expected. So, I used Datalist. However, I am not able to display the data in the required format (2 rows=> 1 for label & 1 for Dropdown)
Posted
Comments
ZurdoDev 13-Apr-15 14:30pm    
What is your question?
Sinisa Hajnal 14-Apr-15 3:30am    
Post your HTML, you're doing something wrong. Also, why use any template if you're creating labels dynamically?

1 solution

Finally I came up with the solution. This is what I wanted.

ASP.NET
<table border="0" width="100%">
        <tr>
        <asp:datalist id="dlstStatus" runat="server" repeatcolumns="0" cellspacing="0"  RepeatDirection="Horizontal" RepeatLayout="Table" Font-Bold="true" BorderWidth="1px" BorderColor="Black" BorderStyle="Double"
                ForeColor="White" BackColor="Gray">
                <itemtemplate> 
                    <td align="center">
                        <asp:label id="lblPA" runat="server" text="<%# Eval("PA_Type") %>"></asp:label></td>
                    <td><asp:dropdownlist runat="server" id="ddlStatus">
                                    <asp:listitem selected="True" text="--Select--" value="Select" />
                                    <asp:listitem text="X" value="X" />
                                    <asp:listitem text="Y" value="Y" />
                                    <asp:listitem text="Z" value="Z" />
                                    </asp:dropdownlist>
                        </td>
                 </itemtemplate>
            </asp:datalist></tr>
   </table>
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900