hey buddies
i got problem with Repeater
this is the code
Aspx page
<%@ Page language="c#" Codebehind="PrintEmployeeDetails.aspx.cs" AutoEventWireup="false" Inherits="ProjectCes.PrintEmployeeDetails" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>PrintRptEmployeeDetails</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:repeater id="RptDetails" runat="server">
<HeaderTemplate>
<TABLE id="Table1" style="Z-INDEX: 101; LEFT: 128px; WIDTH: 544px; POSITION: absolute; TOP: 32px; HEIGHT: 94px"
cellSpacing="1" cellPadding="1" width="544" border="1">
<TR>
<TD align="center" colSpan="4"><STRONG>Employee Details</STRONG>
</TD>
</TR>
</HeaderTemplate>
<ItemTemplate>
<TR>
<TD style="WIDTH: 106px">Employee Code</TD>
<TD style="WIDTH: 120px"><%# DataBinder.Eval(Container.DataItem,"chv_EmpCode")%></TD>
<TD>Employee Name</TD>
<TD><%# DataBinder.Eval(Container.DataItem,"chv_EmpName")%></TD>
</TR>
<TR>
<TD style="WIDTH: 106px">Status</TD>
<TD style="WIDTH: 120px"><%# DataBinder.Eval(Container.DataItem,"chv_Status")%></TD>
<TD>Designation</TD>
<TD><%# DataBinder.Eval(Container.DataItem,"chv_Name")%></TD>
</TR>
<TR>
<TD style="WIDTH: 106px">Scheme</TD>
<TD style="WIDTH: 120px"><%# DataBinder.Eval(Container.DataItem,"chv_Organisation")%></TD>
<TD>Father/Husband's Name</TD>
<TD><%# DataBinder.Eval(Container.DataItem,"Chv_Guardian")%></TD>
</TR>
<TR>
<TD style="WIDTH: 106px">Sex</TD>
<TD style="WIDTH: 120px"><%# DataBinder.Eval(Container.DataItem,"chv_Gender")%></TD>
<TD>Caste</TD>
<TD><%# DataBinder.Eval(Container.DataItem,"chv_Religion")%></TD>
</TR>
<TR>
<TD style="WIDTH: 106px">Salary</TD>
<TD style="WIDTH: 120px"><%# DataBinder.Eval(Container.DataItem,"chv_SalaryThrough")%></TD>
<TD>Grade</TD>
<TD><%# DataBinder.Eval(Container.DataItem,"Grade")%></TD>
</TR>
<TR>
<TD style="WIDTH: 106px; HEIGHT: 23px"></TD>
<TD style="WIDTH: 120px; HEIGHT: 23px"></TD>
<TD style="HEIGHT: 23px"></TD>
<TD style="HEIGHT: 23px"></TD>
</TR>
<TR>
<TD style="WIDTH: 106px; HEIGHT: 23px" colSpan="4">
<asp:repeater id="NestedRepeater" runat="server">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%# DataBinder.Eval(Container.DataItem,"chv_TypeCode")%></td>
<td><%# DataBinder.Eval(Container.DataItem,"dbl_PayingAmount")%></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:repeater>
</TD>
</TR>
</ItemTemplate>
<FooterTemplate>
</TABLE>
</FooterTemplate>
</asp:repeater></form>
</body>
</HTML>
and c# Code
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using SalaryDLL;
namespace ProjectCes
{
/// <summary>
/// Summary description for PrintRptEmployeeDetails.
/// </summary>
public class PrintEmployeeDetails : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Repeater RptDetails;
protected System.Web.UI.WebControls.Repeater RptAllowance;
protected System.Web.UI.WebControls.Repeater RptAll;
reports ObjRpt=new reports();
private void Page_Load(object sender, System.EventArgs e)
{
BindData();
}
public void BindData()
{
object Obj=ObjRpt.funEmployeeDetails() ;
if(Obj is DataSet)
{
DataSet ds=(DataSet)Obj;
ds.Relations.Add(new DataRelation("Allowance",ds.Tables[0].Columns["chv_EmpCode"],ds.Tables[1].Columns["chv_Employeecode"]));
RptDetails.DataSource=ds;
RptDetails.DataBind();
DataTable dt=ds.Tables[0];
}
else if (Obj is Exception)
{
Exception es=(Exception) Obj;
Response.Write("Error at funEmployeeDetails <br>") ;
Response.Write(es.Message);
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.RptDetails.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.RptDetails_ItemDataBound);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void RptDetails_ItemDataBound(object sender, System.Web.UI.WebControls.RepeaterItemEventArgs e)
{
ListItemType lt = e.Item.ItemType;
if(lt == ListItemType.Item || lt == ListItemType.AlternatingItem)
{
DataRowView dv = e.Item.DataItem as DataRowView;
if(dv != null)
{
Repeater nestedRepeater = e.Item.FindControl("NestedRepeater") as Repeater;
if (nestedRepeater != null)
{
nestedRepeater.DataSource = dv.CreateChildView("Allowance");// Problem is here i could not get the reference Datasource nestedRepeater.DataBind();
}
}
}
}
}
}
<%@ Page language="c#" Codebehind="PrintEmployeeDetails.aspx.cs" AutoEventWireup="false" Inherits="ProjectCes.PrintEmployeeDetails" %>