Click here to Skip to main content
15,906,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI Friends,,,


My requirement is

1. In a year we will give a free services for 2 times or 3 times or 4 times based on plan they have paid. It's like a preventive maintenance.

If customer select 3 services in a year i will add the dates as below

Name Service Dates

Sunil 5/2/2013

Sunil 5/5/2013

Sunil 5/8/2013

The above thing will happen on a single button click. We will select only service types (2 times ,3 times ,4 times) .


Please give me a solution for this.
Posted
Updated 18-Feb-13 19:12pm
v2

Hi,

In my opinion you can have a button and a dropdownlist.
The dropdownlist can have the values "2 times","3 times","4 times".
On the selectedindex changed event of the dropdownlist, have a table in SQL which will get the required dates.
And on the button click, display the name of the vendor and the service dates accordingly in a gridview I suppose.

Try the above.
Hope it helps.

regards
anurag
 
Share this answer
 
Comments
PRAKASH_N 19-Feb-13 1:30am    
Thank U..I will try
you have do something like this
int serNo=cmbSerPack.SelectedValue ;//get selected service types 
DateTime SerDate=Calendar1.SelectedDate;//Get date from ur date source

While(serNo > 0)
{
// your insert code here
DateTime answer = SerDate.AddDays(3);
serNo =serNo-1;
}
 
Share this answer
 
v2
XML
<body>
    <form id="form1" runat="server">
    <div>

        <table style="width:100%;">
            <tr>
                <td>
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
            <tr>
                <td>
                    <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                </td>
                <td>
                    &nbsp;</td>
                <td>
                    &nbsp;</td>
            </tr>
        </table>
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />

    </div>
    </form>
</body>



C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        DataTable DT = new DataTable();
        DT.Columns.Add("CODE");
        if (TextBox1.Text != "")
        {
            DT.Rows.Add(TextBox1.Text);
        }
        if (TextBox2.Text != "")
        {
            DT.Rows.Add(TextBox2.Text);
        }
        if (TextBox3.Text != "")
        {
            DT.Rows.Add(TextBox3.Text);
        }
            int j = DT.Rows.Count;
            if (j > 0)
            {
                for (int i = 0; i < j; i++)
                {
                    Response.Write("X");// this is use for test
                    // insert code//
                }
            }
    }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900