ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,674 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
@for (int i = 0; i < Model.TBL_CalismaHayatiList.Count; i++)
{<div class="col-md-6">
<div class="input-block mb-6">
<label class="col-form-label">Giriş Tarihi:</label>
@Html.TextBoxFor(model => model.TBL_CalismaHayatiList[i].GirisTarih, new { @class = "form-control", @id = "date" })
@Html.ValidationMessageFor(model => model.TBL_CalismaHayatiList[i].GirisTarih, "", new { @class = "text-danger" })
</div>
</div>
<div class="col-md-6">
<div class="input-block mb-6">
<label class="col-form-label">Çıkış Tarihi:</label>
@Html.TextBoxFor(model => model.TBL_CalismaHayatiList[i].CikisTarih, new { @class = "form-control", @id = "date" })
@Html.ValidationMessageFor(model => model.TBL_CalismaHayatiList[i].CikisTarih, "", new { @class = "text-danger" })
<span class="form-text text-muted">Gün/Ay/Yıl</span>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="input-block mb-3">
<label class="col-form-label">Eklemek İstedikleriniz:</label>
@Html.TextAreaFor(model => model.TBL_CalismaHayatiList[i].Notlar, new { @class = "form-control", rows = "5", cols = "5", placeholder = "Buraya yazın..." })
</div>
</div>
</div>
}
models:
[DataType(DataType.Date)]
public Nullable<System.DateTime> GirisTarih { get; set; }
[DataType(DataType.Date)]
public Nullable<System.DateTime> CikisTarih { get; set; }
Hello everyone, I have a problem here on the cshtml side, that is, I can apply the date time format I want with @id = "date", but it does not work due to the for loop.
Hello everyone, I have a problem here on the cshtml side, that is, I can apply the date time format I want with @id = "date",
You are not following HTML rules. The id attribute must be unique on the page. It could be the issue if you are using a JavaScript or CSS selector.
but it does not work due to the for loop.
You have to tell us what "does not work" means.
The format depends on the server culture settings:
https://learn.microsoft.com/en-us/dotnet/api/system.datetime.parse?view=net-8.0