How to set a string message when DateTime is default.
Hello,
I have a tablle with columns like startDate and finishedDate of some service. If Service is not finnished I received default DateTime - 01/01/0001 from the database. I would like to display a string like "in progress" or "not finished" etc. Insted Of 01/01/0001.
With best regards Jarosalaw
- Kindly share more information about your query.
- If the service is not completed then how will it return the default datetime?
- Share us a video demo showing the problem you are facing.
- Kindly share us the sample if possible.
Hello,
Thank you for your quick reply.
1.In the table two of the columns are DateTime - ReceivedDate and IssuedDate. When a new comission is being opend the value in ReceiveDate is DateTime.Now and in IssuedDate is null.
On the front-end (blazor) I would like to display a string value (e.g. "In Progress") instead of blank space.
How I could do it?
2. A default value it was my mistake, I was paasing default value to the back-end. Now its null value.
4.
<SfGrid DataSource="@Laundries" AllowPaging="true">
<GridPageSettings PageSize="10" PageCount="5" PageSizes="@pagerDropdown"></GridPageSettings>
<GridColumns>
<GridColumn Field=@nameof(LaundryService.Id) HeaderText="ID"></GridColumn>
<GridColumn Field=@nameof(LaundryService.Name) HeaderText="Service Name"></GridColumn>
<GridColumn Field=@nameof(LaundryService.Number) HeaderText="Number"></GridColumn>
<GridColumn Field=@nameof(LaundryService.RecievedDate) Format="d" HeaderText="Recieved Date"></GridColumn>
<GridColumn Field=@nameof(LaundryService.IssuedDate) Format="d" HeaderText="Issued Date*"></GridColumn>
<GridColumn Field=@nameof(LaundryService.IsFinished) HeaderText="Is Finished"></GridColumn>
</GridColumns>
</SfGrid>
With best regards Jarosław
Attachment: blazor_ec614da3.rar
|
<GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" EditType="EditType.DatePickerEdit" Format="d" TextAlign="TextAlign.Right" Width="130" Type="ColumnType.Date">
<Template>
@{
var con = context as Order;
if (con.OrderDate == null)
{
<span>Inprogress</span>
}
else {
<span>@(String.Format("{0:d}", con.OrderDate))</span>
}
}
</Template>
</GridColumn> |
Thank you! It works perfectly.
With best regards
Jarosław Bolejko
- 5 Replies
- 2 Participants
- Marked answer
-
JB Jaroslaw Bolejko
- Aug 26, 2021 11:20 AM UTC
- Aug 31, 2021 05:44 AM UTC