M
Mohammed Shafiulla Khadri
hi,
I have the following piece of html code in a page
<table width="90%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="26%"> day</td>
<td width="40%">month</td>
<td width="34%">year</td>
</tr>
<tr>
<td align="left">
<select name="dobday" id="dobday" style="width:47" tabindex="9"
runat="server"></select>
</td>
<td align="center">
<select name="dobmonth" id="dobmonth" style="width:54" tabindex="10"
runat="server">
<option value="1">JAN</option>
<option value="2">FEB</option>
<option value="3">MAR</option>
<option value="4">APR</option>
<option value="5">MAY</option>
<option value="6">JUN</option>
<option value="7">JUL</option>
<option value="8">AUG</option>
<option value="9">SEP</option>
<option value="10">OCT</option>
<option value="11">NOV</option>
<option value="12">DEC</option>
</select>
</td>
<td align="left">
<input type="text" name="dobyear" id="dobyear" maxlength="4" value="19"
size="3" tabindex="11" runat="server"/>
</td>
</tr>
</table>
and i am trying to assign the value from the server side . The server side
code is as below which uses the system.globalization namespace and all other
relavant namespaces.
DateTime dt;
CultureInfo dtCulture = new CultureInfo("en-US");
dt = DateTime.Parse(Convert.ToString(Session["DOB"]), dtCulture,
DateTimeStyles.NoCurrentDateDefault);
dobday.Value = Convert.ToString(dt.Date);
dobmonth.Value = Convert.ToString(dt.Month);
dobyear.Value = Convert.ToString(dt.Year);
The dt.Date, dt.Month give the correct information but the value is not
assigned correctly in the html select boxes. Please let me know why the
value is not being set?
Regards,
shafi
I have the following piece of html code in a page
<table width="90%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td width="26%"> day</td>
<td width="40%">month</td>
<td width="34%">year</td>
</tr>
<tr>
<td align="left">
<select name="dobday" id="dobday" style="width:47" tabindex="9"
runat="server"></select>
</td>
<td align="center">
<select name="dobmonth" id="dobmonth" style="width:54" tabindex="10"
runat="server">
<option value="1">JAN</option>
<option value="2">FEB</option>
<option value="3">MAR</option>
<option value="4">APR</option>
<option value="5">MAY</option>
<option value="6">JUN</option>
<option value="7">JUL</option>
<option value="8">AUG</option>
<option value="9">SEP</option>
<option value="10">OCT</option>
<option value="11">NOV</option>
<option value="12">DEC</option>
</select>
</td>
<td align="left">
<input type="text" name="dobyear" id="dobyear" maxlength="4" value="19"
size="3" tabindex="11" runat="server"/>
</td>
</tr>
</table>
and i am trying to assign the value from the server side . The server side
code is as below which uses the system.globalization namespace and all other
relavant namespaces.
DateTime dt;
CultureInfo dtCulture = new CultureInfo("en-US");
dt = DateTime.Parse(Convert.ToString(Session["DOB"]), dtCulture,
DateTimeStyles.NoCurrentDateDefault);
dobday.Value = Convert.ToString(dt.Date);
dobmonth.Value = Convert.ToString(dt.Month);
dobyear.Value = Convert.ToString(dt.Year);
The dt.Date, dt.Month give the correct information but the value is not
assigned correctly in the html select boxes. Please let me know why the
value is not being set?
Regards,
shafi