am developing a chit fund application
i have following controls
Type(chit,EMI)dropdown
Amount(1lac,2lac,3lac..)dropdown
No of Months(12,24,36,48)dropdown
Monthly pay(it should come automatically based on above selection)
Start date
End Date
am developing a chit fund application
i have following controls in my page
Type(chit,EMI,...)dropdown
Amount(1lac,2lac,3lac..)dropdown
No of Months(12,24,36,48)dropdown
Monthly pay(it should come automatically based on above selection)
if i select type is chit
(amount)1lac -> (noofmonths)12months -> then monthly pay show 9800 based following table details
Type Amount NumberofMonths Monthlypay
Chit 1lac 12 9800
Chit 1Lac 24 5800
Chit 1Lac 36 4500
....
....
....
i want to create above table as look up table , by using this data i want to filter data please help
this is my code
demo.aspx
|
Full Name
| <asp:TextBox ID="txtName" runat="server" class="required" Width="170px">
<asp:RequiredFieldValidator ID="rfvname" runat="server" ErrorMessage="*" ControlToValidate="txtName"
ForeColor="#CC3300">
|
Investment Type
| <asp:DropDownList ID="ddlInvestmentType" runat="server" CssClass="search_categories">
<asp:ListItem>--select--
<asp:ListItem>chit
<asp:ListItem>scheme
<asp:ListItem>EMI
<asp:ListItem>Interest
<%-- <asp:TextBox ID="txtInvestmentType" runat="server" class="required email" Width="170px">--%>
|
Amount
| <asp:DropDownList ID="ddlAmount" runat="server" CssClass="search_categories">
<asp:ListItem>--select--
<asp:ListItem>50000
<asp:ListItem>100000
<asp:ListItem>200000
<asp:ListItem>300000
<asp:ListItem>500000
<asp:ListItem>800000
<asp:ListItem>1000000
<asp:ListItem>2500000
<%--<asp:RequiredFieldValidator ID="rfvamount" runat="server" ErrorMessage="*" ControlToValidate="txtAmount"
ForeColor="#CC3300">--%>
|
Monthly Pay
| <asp:TextBox ID="txtMonthlyPay" runat="server" class="password comfirm_password"
Width="170px">
<asp:RequiredFieldValidator ID="rfvmonthlypay" runat="server" ErrorMessage="*" ControlToValidate="txtMonthlyPay"
ForeColor="#CC3300">
|
No of Months
| <asp:TextBox ID="txtNoOfMonths" runat="server" class="required mobile" Width="170px">
<asp:RequiredFieldValidator ID="rfvnomonths" runat="server" ErrorMessage="*" ControlToValidate="txtNoOfMonths"
ForeColor="#CC3300">
|
Start Date
| <asp:TextBox ID="txtStartDate" runat="server" class="required mobile" Width="170px"
OnTextChanged="txtStartDate_TextChanged" AutoPostBack="true">
|
End Date
| <asp:TextBox ID="txtEndDate" runat="server" class="required mobile" Width="170px"
ReadOnly="True">
|
demo.cs
protected void btnSubmit_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand();
SqlDataAdapter da = new SqlDataAdapter(cmd);
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "SP_PaymentTracker";
cmd.Parameters.AddWithValue("@Name", txtName.Text);
cmd.Parameters.AddWithValue("@InvestmentType", ddlInvestmentType.SelectedItem.ToString());
cmd.Parameters.AddWithValue("@Amount", ddlAmount.SelectedItem.ToString());
cmd.Parameters.AddWithValue("@MonthlyPay", txtMonthlyPay.Text);
cmd.Parameters.AddWithValue("@NumberOfMonths", txtNoOfMonths.Text);
cmd.Parameters.AddWithValue("@StartDate", txtStartDate.Text);
cmd.Parameters.AddWithValue("@EndDate", txtEndDate.Text);
cmd.Parameters.AddWithValue("@Phone", txtMobile.Text);
cmd.Parameters.AddWithValue("@Address", txtAddress.Text);
cmd.Connection = con;
lblmsg.Visible = true;
lblmsg.Text = "Inserted";
try
{
con.Open();
cmd.ExecuteNonQuery();
BindDummyRow();
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
con.Dispose();
txtName.Text = ddlInvestmentType.Text = ddlAmount.Text = txtMonthlyPay.Text =
txtNoOfMonths.Text = txtStartDate.Text = txtEndDate.Text = txtMobile.Text = txtAddress.Text = string.Empty;
}
}
protected void txtStartDate_TextChanged(object sender, EventArgs e)
{
string inputString = txtStartDate.Text;
DateTime dt = DateTime.ParseExact(inputString, "MM/dd/yyyy", CultureInfo.InvariantCulture);
dt = dt.AddMonths(Convert.ToInt32(txtNoOfMonths.Text));
txtEndDate.Text = dt.ToString("MM/dd/yyyy");
txtMobile.Focus();
}