protected void CreateChildControls(string[] pIds) { int existingAddress = 0; for (int i = 0; i < pIds.Length; i++) { int ptId = int.Parse(pIds[i]); Modules_FollowUp_Surveys_AddressLabel addressControl = Page.LoadControl("Surveys/AddressLabel.ascx") as Modules_FollowUp_Surveys_AddressLabel; addressControl.PatientId = ptId; addressControl.BindToPatient(); if (addressControl.Visible) { // Determine if we neeed to add break if (existingAddress >= MaxLabels && existingAddress % MaxLabels == 0) { // Add page break Panel breakControl = new Panel(); breakControl.CssClass = "PageBreaker"; DynamicAddressHolder.Controls.Add(breakControl); Panel breakControlSpacing = new Panel(); breakControlSpacing.CssClass = "PageBreakerTopSpacing"; DynamicAddressHolder.Controls.Add(breakControlSpacing); } // Add address to container DynamicAddressHolder.Controls.Add(addressControl); existingAddress++; } } }
/// <summary> /// Set AddressLabel control's display helpers /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SetPatientInfo(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { string ptName = DataBinder.Eval(e.Item.DataItem, Patient.PtFirstName).ToString(); string ptAddress = DataBinder.Eval(e.Item.DataItem, Patient.PtAddress1).ToString(); Modules_FollowUp_Surveys_AddressLabel addressControl = e.Item.FindControl("PtAddress") as Modules_FollowUp_Surveys_AddressLabel; addressControl.PatientName = ptName; addressControl.PatientAddress = ptAddress; } }