Hi! I have calendar, textbox and gridview in form. When I click calendar then show date in textbox(19.10.2016). But I want show date and time in textbox. I get date from calendar and time from gridview it’s worked correct some computer and incorrect some computer. After click gridview it’s show this. 19/10.2016 16.09. I want always show this format 19.10.2016 16.10.
<script src="Scripts/jquery-1.8.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("[id*=Grid] td").bind("click", function () {
var date = $('[id*=hfsana]').val();
$('[id*=Tbox]').val(date + ' ' + $(this).html());
});
return false;
});
</script>
<script type="text/javascript">
$(function () {
var th = $('[title="Calendar"]').find('tr').eq(2).find('th');
$(th)[0].innerHTML = 'Як'; // SunDay
$(th)[1].innerHTML = 'Дш'; // MonDay
$(th)[2].innerHTML = 'Сш'; // TuesDay
$(th)[3].innerHTML = 'Чш'; // WednesDay
$(th)[4].innerHTML = 'Пш'; // ThursDay
$(th)[5].innerHTML = 'Ҷм'; // Friday
$(th)[6].innerHTML = 'Шб'; // Saturday
});
</script>
<asp:Calendar ID="Calendar" runat="server"
onselectionchanged="Calendar_SelectionChanged">
</asp:Calendar>
protected void Calendar_SelectionChanged(object sender, EventArgs e)
{
DateTime dt = new DateTime();
dt = Convert.ToDateTime(DateTime.Now.ToShortDateString());
DateTime dat = new DateTime();
dat = Convert.ToDateTime(Calendar.SelectedDate.ToShortDateString());
if (dat >= dt)
{
Tbox.Text = dat.ToString("dd.MM.yyyy");
}
else
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "ErrorAlert", "alert('Санаи гузашта интихоб карда намешавад!!!');", true);
Tbox.Text = "";
}
if (dat.ToShortDateString().Length == 4)
{
data = dat.ToShortDateString();// +"0" + dat.ToShortDateString();
hfsana.Value = dat.ToShortDateString();
}
else
{
data = dat.ToShortDateString();
hfsana.Value = dat.ToShortDateString();
}
}