Hello,
(C# AND ASP.NET)
For a particular employee i have his details stored in the database. These details also contain joining date which is stored in the database in the format yyyy-mm-dd.

In the front end i have 3 dropdown lists one for DD another for MM and the third one for YYYY. All these 3 ddl's are filled up by appropriate values on load.

When i wish to see a particular record of the employee i should get to see the joining date of employee in its respective ddl selected.

For Ex:

In my database say date is 2000-01-01 for employee No 1.
so when i select to see the details of employee No 1.. the joining date should be displayed in my front end as:

In my Day ddl i should 01 selected
in my Month ddl i should 01 selected
and my Year ddl i should get 2000 selected.

Please anyone can help me out...??

Awating reply...

cya,
Rohan

on page load you are filling all the DROPdownlist
that is correct next you need to check the Employee date of joining
which u can get it from the database and store in string. use substring to
divide year, month and date and bind the DropDown accordingly by using

// Basic Part for Loading DropDown..
        for (int i = 1961; i < DateTime.Now.Year; i++)
        {
            DropDownList1.Items.Add(i.ToString());
        }

        // Next you wanna load 2008

        DropDownList1.Text = "2008"; // This would be the value from the DataBase

There are other ways to do it..!
hope that helps.

the other way is, you can use Year(yourcolumnname), Month(yourcolumnname), Day(yourcolumnname) functions of SQL server and bind your drop down accordingly..

hope it will help you...

========================================================================================

Hello,
(C# AND ASP.NET)
For a particular employee i have his details stored in the database. These details also contain joining date which is stored in the database in the format yyyy-mm-dd.

In the front end i have 3 dropdown lists one for DD another for MM and the third one for YYYY. All these 3 ddl's are filled up by appropriate values on load.

When i wish to see a particular record of the employee i should get to see the joining date of employee in its respective ddl selected.

For Ex:

In my database say date is 2000-01-01 for employee No 1.
so when i select to see the details of employee No 1.. the joining date should be displayed in my front end as:

In my Day ddl i should 01 selected
in my Month ddl i should 01 selected
and my Year ddl i should get 2000 selected.

Please anyone can help me out...??

Awating reply...

cya,
Rohan

DateTime DbDate = new DateTime()

DbDate.Day;
DbDate.Month;
DabDate.Year;

Once you declare DbDate just use .Day, .Month, or .Year to get what you want.