Click here to Skip to main content
15,914,642 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have one field dropdown.

Date of birth Dropdown

Calendar

when i click the calendar that date should be displayed.(Whichever date i click that date should be displayed in dropdown).
Posted
Comments
MT_ 26-Oct-12 5:28am    
So, what is the problem ? can you show some code and issue you are facing with the code that you have written?
[no name] 26-Oct-12 7:20am    
Why you want to display date of birth in a dropdown? DropDown should be used when there can be multiple options. I beleve none of us have 2 DOBs. My suggestion is to display selected DOB in a Label/TextBox

I cant determine what you Exactly want to do..Please Provide Detailed Requirement what the exact situation is.
 
Share this answer
 
Comments
[no name] 26-Oct-12 7:16am    
Banci we have comment option provided for any query .. use them instead of posting your answers in solution section
May I think your looking for this

In your aspx page

XML
<asp:Calendar ID="Calendar1" runat="server"
    onselectionchanged="Calendar1_SelectionChanged"></asp:Calendar>
    <asp:DropDownList ID="DropDownList1" runat="server">
        <asp:ListItem>1</asp:ListItem>
        <asp:ListItem>2</asp:ListItem>
        <asp:ListItem>3</asp:ListItem>
        <asp:ListItem>4</asp:ListItem>
        <asp:ListItem>5</asp:ListItem>
        <asp:ListItem>6</asp:ListItem>
        <asp:ListItem>7</asp:ListItem>
        <asp:ListItem>8</asp:ListItem>
        <asp:ListItem>9</asp:ListItem>
        <asp:ListItem>10</asp:ListItem>
        <asp:ListItem>11</asp:ListItem>
        <asp:ListItem>12</asp:ListItem>
        <asp:ListItem>13</asp:ListItem>
        <asp:ListItem>14</asp:ListItem>
        <asp:ListItem>15</asp:ListItem>
        <asp:ListItem>16</asp:ListItem>
        <asp:ListItem>17</asp:ListItem>
        <asp:ListItem>18</asp:ListItem>
        <asp:ListItem>19</asp:ListItem>
        <asp:ListItem>20</asp:ListItem>
        <asp:ListItem>21</asp:ListItem>
        <asp:ListItem>22</asp:ListItem>
        <asp:ListItem>23</asp:ListItem>
        <asp:ListItem>24</asp:ListItem>
        <asp:ListItem>25</asp:ListItem>
        <asp:ListItem>26</asp:ListItem>
        <asp:ListItem>27</asp:ListItem>
        <asp:ListItem>28</asp:ListItem>
        <asp:ListItem>29</asp:ListItem>
        <asp:ListItem>30</asp:ListItem>
        <asp:ListItem>31</asp:ListItem>
        <asp:ListItem></asp:ListItem>
    </asp:DropDownList>


Add dates in Items Collection property of DropDownlist. Dates will be static only i.e. 31 max.

in you aspx.cs page
C#
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        DateTime dt = Calendar1.SelectedDate;
        DropDownList1.SelectedValue = dt.Date.ToString("dd");
    }
 
Share this answer
 
v4
Try this,
SQL
ddlfieldnames.Items.Clear();
       ddlfieldnames.Items.Add(calender.SelectedDate.ToString());
 
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