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" %>
http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
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 description for PrintRptEmployeeDetails.
///
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
") ;
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);
}
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
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" %>
Replies
Know the answer? Post it — somebody with the same question will find it here.