Exculurlpug
New Member
I have following tags to select date first is for day,second for month and third for year\[code\]<select id="d" class="styledselect-day" tabindex="6"> <option value="">dd</option> <option value="http://stackoverflow.com/questions/15894647/1">1</option> <option value="http://stackoverflow.com/questions/15894647/2">2</option> <option value="http://stackoverflow.com/questions/15894647/3">3</option> <option value="http://stackoverflow.com/questions/15894647/4">4</option> <option value="http://stackoverflow.com/questions/15894647/5">5</option> <option value="http://stackoverflow.com/questions/15894647/6">6</option> <option value="http://stackoverflow.com/questions/15894647/7">7</option> <option value="http://stackoverflow.com/questions/15894647/8">8</option> <option value="http://stackoverflow.com/questions/15894647/9">9</option> <option value="http://stackoverflow.com/questions/15894647/10">10</option> <option value="http://stackoverflow.com/questions/15894647/11">11</option> <option value="http://stackoverflow.com/questions/15894647/12">12</option> <option value="http://stackoverflow.com/questions/15894647/13">13</option> <option value="http://stackoverflow.com/questions/15894647/14">14</option> <option value="http://stackoverflow.com/questions/15894647/15">15</option> <option value="http://stackoverflow.com/questions/15894647/16">16</option> <option value="http://stackoverflow.com/questions/15894647/17">17</option> <option value="http://stackoverflow.com/questions/15894647/18">18</option> <option value="http://stackoverflow.com/questions/15894647/19">19</option> <option value="http://stackoverflow.com/questions/15894647/20">20</option> <option value="http://stackoverflow.com/questions/15894647/21">21</option> <option value="http://stackoverflow.com/questions/15894647/22">22</option> <option value="http://stackoverflow.com/questions/15894647/23">23</option> <option value="http://stackoverflow.com/questions/15894647/24">24</option> <option value="http://stackoverflow.com/questions/15894647/25">25</option> <option value="http://stackoverflow.com/questions/15894647/26">26</option> <option value="http://stackoverflow.com/questions/15894647/27">27</option> <option value="http://stackoverflow.com/questions/15894647/28">28</option> <option value="http://stackoverflow.com/questions/15894647/29">29</option> <option value="http://stackoverflow.com/questions/15894647/30">30</option> <option value="http://stackoverflow.com/questions/15894647/31">31</option> </select><select id="m" class="styledselect-month" tabindex="7" > <option value="">mm</option> <option value="http://stackoverflow.com/questions/15894647/1">Jan</option> <option value="http://stackoverflow.com/questions/15894647/2">Feb</option> <option value="http://stackoverflow.com/questions/15894647/3">Mar</option> <option value="http://stackoverflow.com/questions/15894647/4">Apr</option> <option value="http://stackoverflow.com/questions/15894647/5">May</option> <option value="http://stackoverflow.com/questions/15894647/6">Jun</option> <option value="http://stackoverflow.com/questions/15894647/7">Jul</option> <option value="http://stackoverflow.com/questions/15894647/8">Aug</option> <option value="http://stackoverflow.com/questions/15894647/9">Sep</option> <option value="http://stackoverflow.com/questions/15894647/10">Oct</option> <option value="http://stackoverflow.com/questions/15894647/11">Nov</option> <option value="http://stackoverflow.com/questions/15894647/12">Dec</option> </select><select id="y" class="styledselect-year" tabindex="8"><option value="http://stackoverflow.com/questions/15894647/yyyy">yyyy</option><option value="http://stackoverflow.com/questions/15894647/2005">2005</option><option value="http://stackoverflow.com/questions/15894647/2006">2006</option><option value="http://stackoverflow.com/questions/15894647/2007">2007</option><option value="http://stackoverflow.com/questions/15894647/2008">2008</option><option value="http://stackoverflow.com/questions/15894647/2009">2009</option><option value="http://stackoverflow.com/questions/15894647/2010">2010</option><option value="http://stackoverflow.com/questions/15894647/2011">2011</option><option value="http://stackoverflow.com/questions/15894647/2012">2012</option> </select>\[/code\]And following is JS code, using which i am sending information to controller. Where i am storing these information in Session\[code\]$.ajax({ type: "POST", url: "@Url.Action("AcceptPersonalInfo","Register")", data: { dateDay: $("#d").val(), dateMonth: $("#m").val(), dateYear: $("#y").val() }, success: function () { $("#contentSpan").load("/Register/ContactInfo"); } });\[/code\]Following is Session code\[code\]public void AcceptPersonalInfo(string dateDay, string dateMonth, string dateYear) // { Session["DateDay"] = dateDay; Session["DateMonth"] = dateMonth; Session["DateYear"] = dateYear; }\[/code\]Then i have to store date in DateTime object to save into databse.\[code\]p.DOB = Convert.ToDateTime(Convert.ToInt32(Session["DateMonth"]) + Convert.ToInt32(Session["DateDay"]) + Convert.ToInt32(Session["DateYear"]));\[/code\]But it is not converting it into datetime. "p.DOB" is of DateTime type. Pls help why conversion failed.