Hi, i have a user control that i have used 10 times on a web page. i only want it to show one and when that one has been select then another one must appear under it and so on
below is the code of the user control
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ucFamilyFuneral.ascx.cs"
Inherits="Assupol.Mobi.WebClient.Controls.ucFamilyFuneral" %>
<%@ Register Src="ucDatePicker.ascx" TagName="ucDatePicker" TagPrefix="uc1" %>
<asp:Table ID="tblAddFuneral" runat="server">
<asp:TableRow ID="tblHeader" runat="server">
<asp:TableCell ID="TableCell5" runat="server" Style="width: 200px; height: 18px;" class="calc-displayCellLabel">
Date Of Birth
</asp:TableCell>
<asp:TableCell ID="TableCell6" runat="server" Style="width: 187px;" class="calc-displayCellLabel">
Relationship to Applicant
</asp:TableCell>
<asp:TableCell ID="TableCell7" runat="server" Style="width: 185px;" class="calc-displayCellLabel">
Benefit Amount
</asp:TableCell>
<asp:TableCell ID="TableCell8" runat="server" Style="width: 140px;" class="calc-displayCellLabel">
Accidental Death
</asp:TableCell>
</asp:TableRow>
<asp:TableRow ID="TableRow1" runat="server">
<asp:TableCell ID="TableCell1" runat="server" Style="width: 200px; height: 18px;">
<uc1:ucDatePicker ID="ucDatePickerDOB" runat="server" CssClass="calc-displayCellContent" />
</asp:TableCell>
<asp:TableCell ID="TableCell2" runat="server" Style="width: 187px;">
<asp:DropDownList ID="ddlRelation" runat="server" CssClass="calc-displayCellContent">
</asp:DropDownList>
</asp:TableCell>
<asp:TableCell ID="TableCell3" runat="server" Style="width: 185px;">
<asp:DropDownList ID="ddlFuneralCover" runat="server" CssClass="calc-displayCellContent">
</asp:DropDownList>
</asp:TableCell>
<asp:TableCell ID="TableCell4" runat="server" Style="width: 140px;">
<asp:CheckBox ID="chkAccidental" runat="server" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
using System;
using Assupol.FutureWealth.Calculations;
using Assupol.FutureWealth.Shared.Enumerations;
using Assupol.Mobi.Shared.Enumerations;
namespace Assupol.Mobi.WebClient.Controls
{
public partial class ucFamilyFuneral : System.Web.UI.UserControl
{
#region Protected Members
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) _doDataBinding();
}
#endregion
#region Public Members
public bool DisplayHeader
{
set { tblHeader.Visible = value; }
}
public bool Enabled
{
set
{
ucDatePickerDOB.Enabled = value;
ddlFuneralCover.Enabled = value;
ddlRelation.Enabled = value;
}
}
public bool Populated
{
get
{
if (ddlRelation.SelectedIndex <= 0) return false;
return ddlFuneralCover.SelectedIndex > 0;
}
}
public RelationshipType Relationship
{
get
{
if (ddlRelation.SelectedIndex <= 0) throw new ArgumentException("No value selected for 'RelationshipType'");
return (RelationshipType)Enum.Parse(typeof(RelationshipType), ddlRelation.SelectedValue);
}
}
public decimal FuneralCover
{
get
{
if (ddlFuneralCover.SelectedIndex <= 0) throw new ArgumentException("No value selected for 'FuneralCover'");
return Convert.ToDecimal(ddlFuneralCover.SelectedValue);
}
}
public DateTime DateOfBirth
{
get { return ucDatePickerDOB.Date; }
}
public decimal Premium(DateTime InceptionDate)
{
var ret = decimal.Zero;
lblFuneralPremium.Text = Helper.FormatCurrency(ret, 2);
ret = _calculateDependantPremium(Relationship, Helper.Age(InceptionDate, DateOfBirth), FuneralCover);
lblFuneralPremium.Text = Helper.FormatCurrency(ret, 2);
return ret;
}
#endregion
#region Private Members
private void _doDataBinding()
{
ddlRelation.DataTextField = "Description";
ddlRelation.DataValueField = "RelationshipID";
ddlRelation.DataSource = LookUpCache.Instance.ListRelationShip(MasterPolicyType.ExcellenceFamilyFuneralPlanV4, true);
ddlRelation.DataBind();
ddlFuneralCover.DataTextField = "Description";
ddlFuneralCover.DataValueField = "Value";
ddlFuneralCover.DataSource = LookUpCache.Instance.LookUp(LookUpType.ExcelFuneralPlanAdditionalCover, true);
ddlFuneralCover.DataBind();
}
private decimal _calculateDependantPremium(RelationshipType relationship, int age, decimal sumAssured)
{
var ret = decimal.Zero;
var calculator = new ExcelFuneralPlanV4BusinessObject();
switch (relationship)
{
case (RelationshipType.Spouse):
ret = decimal.Zero;
break;
case (RelationshipType.Son21OrYounger):
case (RelationshipType.Daughter21OrYounger):
ret = calculator.CalculateFuneralPremiumSpouseChildren();
break;
case (RelationshipType.Aunt):
case (RelationshipType.Brother):
case (RelationshipType.BrotherInlaw):
case (RelationshipType.Cousin):
case (RelationshipType.DaugtherAbove21):
case (RelationshipType.Employee):
case (RelationshipType.Employer):
case (RelationshipType.Estate):
case (RelationshipType.Father):
case (RelationshipType.FatherInLaw):
case (RelationshipType.GrandChild):
case (RelationshipType.Grandfather):
case (RelationshipType.Grandmother):
case (RelationshipType.Mother):
case (RelationshipType.MotherInLaw):
case (RelationshipType.Nephew):
case (RelationshipType.Niece):
case (RelationshipType.Sister):
case (RelationshipType.SisterInLaw):
case (RelationshipType.SonAbove21):
case (RelationshipType.TrustInstitution):
case (RelationshipType.Uncle):
ret = calculator.CalculateFuneralPremiumOther();
break;
default:
throw new ArgumentException(string.Format("RelationshipType of '{0}' not supported", relationship));
}
return ret;
}
#endregion
}
}
<table class="calc-TableFlush calc-displayCellContent">
<tr>
<td class="calc-sectionHeader">Other lives insured </td>
</tr>
<tr>
<td>
<uc3:ucFamilyFuneral ID="ucFamilyFuneralone" runat="server" CssClass="calc-displayCellContent" />
</td>
</tr>
<tr>
<td >
<uc3:ucFamilyFuneral ID="ucFamilyFuneraltwo" runat="server" CssClass="calc-displayCellContent" />
</td>
</tr>
<tr>
<td>
<uc3:ucFamilyFuneral ID="ucFamilyFuneralthree" runat="server" CssClass="calc-displayCellContent" />
</td>
</tr>
<tr>
<td>
<uc3:ucFamilyFuneral ID="ucFamilyFuneralfour" runat="server" CssClass="calc-displayCellContent" />
</td>
</tr>
<tr>
<td>
<uc3:ucFamilyFuneral ID="ucFamilyFuneralfive" runat="server" CssClass="calc-displayCellContent" />
</td>
</tr>
<tr>
<td>
<uc3:ucFamilyFuneral ID="ucFamilyFuneralsix" runat="server" CssClass="calc-displayCellContent" />
</td>
</tr>
<tr>
<td>
<uc3:ucFamilyFuneral ID="ucFamilyFuneralseven" runat="server" CssClass="calc-displayCellContent" />
</td>
</tr>
<tr>
<td>
<uc3:ucFamilyFuneral ID="ucFamilyFuneraleight" runat="server" CssClass="calc-displayCellContent" />
</td>
</tr>
<tr>
<td>
<uc3:ucFamilyFuneral ID="ucFamilyFuneralnine" runat="server" CssClass="calc-displayCellContent" />
</td>
</tr>
<tr>
<td>
<uc3:ucFamilyFuneral ID="ucFamilyFuneralten" runat="server" CssClass="calc-displayCellContent" />
</td>
</tr>
</table>