I have a project which in one module is like comparing two or more products. It's working properly but not displaying the proper design (output).
Here I have one image which i want.
and my output displaying like:
I have them displaying on repeater control. Here I have also my code .aspx file
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table style="border: 1px solid #0000FF; width: 500px" cellpadding="0">
<tr style="background-color: #FF6600; color: #000000; font-size: large; font-weight: bold;">
<td colspan="2">
Sector Name
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table style="border: 1px solid #0000FF; width: 500px" cellpadding="0">
<tr style="color: #000000; font-size: large; font-weight: bold;">
<td colspan="2">
<%# Eval("fieldname") %></span><b> :</b> <span>
</td>
<td>
<%# Eval("fielddetails")%></span> <b> </b>
</td>
</tr>
<tr style="background-color: #FF6600; color: #000000; font-size: large; font-weight: bold;">
<td colspan="2">
</td>
</tr>
</table>
</ItemTemplate>
</asp:Repeater>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
.aspx.cs
SqlCommand cmd = new SqlCommand(" select fieldname,fielddetails from finalcomparedata where compare_id= "+6+" ", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
Repeater1.DataSource = ds;
Repeater1.DataBind();
con.Close();
Start your Table tag in header template and Add Table Headings There. Your Rows will be added in ItemTemplate and close tour table tag in footer template..like shown below
<asp:Repeater ID="Repeater1" runat="server">
<HeaderTemplate>
<table >
<tr>
<th>Sector Name</th>
<th>Heading2</th>
<th>Heading3</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td >
<%# Eval("SectorName") %>
</td>
<td >
<%# Eval("Heading2") %>
</td>
<td >
<%# Eval("Heading3") %>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.