Renu Saraswat

Renu Saraswat

  • NA
  • 90
  • 1.7k

How to use nested repeater in c# when header part multiple

Apr 21 2017 2:00 AM
<asp:Repeater ID="RepDetails" runat="server">
<HeaderTemplate>
<table style="border:1px solid:df5015;" width:"1000px" cellpadding="0">
<tr style="background-color:#df5015; color:White; font-size=18px";>
<td colspan="2">
<b>Design Part1</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:1000px" >
<tr>
<td>
<asp:Hyperlink ID="lnkE" runat="server" Text='<%# Bind("SubjectE") %>' Target="_blank" NavigateUrl='<%# Bind("AttachmentEng","~/WriteReadData_horti/Images/{0}") %>' ></asp:Hyperlink>
<%-- <asp:Label ID="lblSubject" runat="server" Text='<%#Eval("Subject") %>' Font-Bold="true"/>--%>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Repeater ID="RepDetails1" runat="server">
<HeaderTemplate>
<table style="border:1px solid:df5015;" width:"1000px" cellpadding="0">
<tr style="background-color:#df5015; color:White; font-size=18px";>
<td colspan="2">
<b>General Conditions </b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:1000px" >
<tr>
<td>
<asp:Hyperlink ID="lnkE" runat="server" Text='<%# Bind("SubjectE") %>' Target="_blank" NavigateUrl='<%# Bind("AttachmentEng","~/WriteReadData_horti/Images/{0}") %>' ></asp:Hyperlink>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Repeater ID="Repeater2" runat="server">
<HeaderTemplate>
<table style="border:1px solid:df5015;" width:"1000px" cellpadding="0">
<tr style="background-color:#df5015; color:White; font-size=18px";>
<td colspan="2">
<b>Area</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:1000px" >
<tr>
<td>
<asp:Hyperlink ID="lnkE" runat="server" Text='<%# Bind("SubjectE") %>' Target="_blank" NavigateUrl='<%# Bind("AttachmentEng","~/WriteReadData_horti/Images/{0}") %>' ></asp:Hyperlink>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Repeater ID="Repeater3" runat="server">
<HeaderTemplate>
<table style="border:1px solid:df5015;" width:"1000px" cellpadding="0">
<tr style="background-color:#df5015; color:White; font-size=18px";>
<td colspan="2">
<b>Analysis  for Delhi
</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:1000px" >
<tr>
<td>
<asp:Hyperlink ID="lnkE" runat="server" Text='<%# Bind("SubjectE") %>' Target="_blank" NavigateUrl='<%# Bind("AttachmentEng","~/WriteReadData_horti/Images/{0}") %>' ></asp:Hyperlink>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Repeater ID="Repeater4" runat="server">
<HeaderTemplate>
<table style="border:1px solid:df5015;" width:"1000px" cellpadding="0">
<tr style="background-color:#df5015; color:White; font-size=18px";>
<td colspan="2">
<b>Plinth Area Rates</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:1000px" >
<tr>
<td>
<asp:Hyperlink ID="lnkE" runat="server" Text='<%# Bind("SubjectE") %>' Target="_blank" NavigateUrl='<%# Bind("AttachmentEng","~/WriteReadData_horti/Images/{0}") %>' ></asp:Hyperlink>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Repeater ID="Repeater5" runat="server">
<HeaderTemplate>
<table style="border:1px solid:df5015;" width:"1000px" cellpadding="0">
<tr style="background-color:#df5015; color:White; font-size=18px";>
<td colspan="2">
<b>Schedules of Rates (Electrical)
</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:1000px" >
<tr>
<td>
<asp:Hyperlink ID="lnkE" runat="server" Text='<%# Bind("SubjectE") %>' Target="_blank" NavigateUrl='<%# Bind("AttachmentEng","~/WriteReadData_horti/Images/{0}") %>' ></asp:Hyperlink>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Repeater ID="Repeater6" runat="server">
<HeaderTemplate>
<table style="border:1px solid:df5015;" width:"1000px" cellpadding="0">
<tr style="background-color:#df5015; color:White; font-size=18px";>
<td colspan="2">
<b>Specifications Other
</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:1000px" >
<tr>
<td>
<asp:Hyperlink ID="lnkE" runat="server" Text='<%# Bind("SubjectE") %>' Target="_blank" NavigateUrl='<%# Bind("AttachmentEng","~/WriteReadData_horti/Images/{0}") %>' ></asp:Hyperlink>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Repeater ID="Repeater7" runat="server">
<HeaderTemplate>
<table style="border:1px solid:df5015;" width:"1000px" cellpadding="0">
<tr style="background-color:#df5015; color:White; font-size=18px";>
<td colspan="2">
<b>Specifications</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:1000px" >
<tr>
<td>
<asp:Hyperlink ID="lnkE" runat="server" Text='<%# Bind("SubjectE") %>' Target="_blank" NavigateUrl='<%# Bind("AttachmentEng","~/WriteReadData_horti/Images/{0}") %>' ></asp:Hyperlink>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Repeater ID="Repeater8" runat="server">
<HeaderTemplate>
<table style="border:1px solid:df5015;" width:"1000px" cellpadding="0">
<tr style="background-color:#df5015; color:White; font-size=18px";>
<td colspan="2">
<b>Design Pattern</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:1000px" >
<tr>
<td>
<asp:Hyperlink ID="lnkE" runat="server" Text='<%# Bind("SubjectE") %>' Target="_blank" NavigateUrl='<%# Bind("AttachmentEng","~/WriteReadData_horti/Images/{0}") %>' ></asp:Hyperlink>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Repeater ID="Repeater9" runat="server">
<HeaderTemplate>
<table style="border:1px solid:df5015;" width:"1000px" cellpadding="0">
<tr style="background-color:#df5015; color:White; font-size=18px";>
<td colspan="2">
<b>Other1</b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:1000px" >
<tr>
<td>
<asp:Hyperlink ID="lnkE" runat="server" Text='<%# Bind("SubjectE") %>' Target="_blank" NavigateUrl='<%# Bind("AttachmentEng","~/WriteReadData_horti/Images/{0}") %>' ></asp:Hyperlink>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
<asp:Repeater ID="Repeater10" runat="server">
<HeaderTemplate>
<table style="border:1px solid:df5015;" width:"1000px" cellpadding="0">
<tr style="background-color:#df5015; color:White; font-size=18px";>
<td colspan="2">
<b>Other </b>
</td>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr style="background-color:#EBEFF0">
<td>
<table style="background-color:#EBEFF0;border-top:1px dotted #df5015; width:1000px" >
<tr>
<td>
<asp:Hyperlink ID="lnkE" runat="server" Text='<%# Bind("SubjectE") %>' Target="_blank" NavigateUrl='<%# Bind("AttachmentEng","~/WriteReadData_horti/Images/{0}") %>' ></asp:Hyperlink>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
 
 
 
C# code---
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class cpwdnew_Documents_View_Publication : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConCPWD"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindRepeaterData();
BindRepeaterData1();
BindRepeaterData2();
BindRepeaterData4();
BindRepeaterData5();
BindRepeaterData6();
BindRepeaterData7();
BindRepeaterData8();
BindRepeaterData9();
BindRepeaterData10();
}
}
protected void BindRepeaterData()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD_Publication where category='Manuals' Order By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
RepDetails.DataSource = ds;
RepDetails.DataBind();
con.Close();
}
protected void BindRepeaterData1()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD_Publication where category='Government Condition of Contract' Order By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
RepDetails1.DataSource = ds;
RepDetails1.DataBind();
con.Close();
}
protected void BindRepeaterData2()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD_Publication where category='Area ' Order By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
Repeater2.DataSource = ds;
Repeater2.DataBind();
con.Close();
}
protected void BindRepeaterData3()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD_Publication where category='Analysis Delhi' Order By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
Repeater2.DataSource = ds;
Repeater3.DataBind();
con.Close();
}
protected void BindRepeaterData4()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD_Publication where category='Schedules of Rates (Electrical)' Order By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
Repeater4.DataSource = ds;
Repeater4.DataBind();
con.Close();
}
protected void BindRepeaterData5()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD_Publication where category='Design Pattrn' Order By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
Repeater5.DataSource = ds;
Repeater5.DataBind();
con.Close();
}
protected void BindRepeaterData6()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD_Publication where category='Schedules Other' Order By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
Repeater6.DataSource = ds;
Repeater6.DataBind();
con.Close();
}
protected void BindRepeaterData7()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD_Publication where category='Specifications' Order By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
Repeater7.DataSource = ds;
Repeater7.DataBind();
con.Close();
}
protected void BindRepeaterData8()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD_Publication where category='Specifications' Order By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
Repeater8.DataSource = ds;
Repeater8.DataBind();
con.Close();
}
protected void BindRepeaterData9()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD_Publication where category='Schedule ' Order By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
Repeater9.DataSource = ds;
Repeater9.DataBind();
con.Close();
}
protected void BindRepeaterData10()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD where category='Government Condition  By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
Repeater10.DataSource = ds;
Repeater10.DataBind();
con.Close();
}/*
protected void BindRepeaterData11()
{
con.Open();
SqlCommand cmd = new SqlCommand("select * from ADD_Publication where category='Other  Order By PublicationYear desc", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
RepDetails11.DataSource = ds;
RepDetails11.DataBind();
con.Close();
}*/
}
 

Answers (1)