Hi,
I came across some unusual behaviour
I wanted to hide the default form submit button so I could put it elsewhere on the page but once I had an empty FormButton element on the page I was unable to print any more
<FormButtons></FormButtons>
a solution to my problem was to put an empty span in the element
<FormButtons><span></span></FormButtons>
Hello everyone,
I can't seem to reproduce the problem anymore, but just in case, here is how to hide the empty <FormButtons> container completely, so that it doesn't interfere with printing:
<style>
.no-form-buttons .k-form-buttons {
display: none;
}
</style>
<TelerikForm Model="@Employee"
Width="300px"
Class="no-form-buttons">
<FormItems>
<FormItem Field="@nameof(Person.FirstName)" LabelText="First Name"></FormItem>
<FormItem Field="@nameof(Person.LastName)" LabelText="Last Name"></FormItem>
<FormItem Field="@nameof(Person.BirthDate)" LabelText="Birth Date"></FormItem>
</FormItems>
<FormButtons></FormButtons>
</TelerikForm>
@code {
private Person? Employee { get; set; } = new();
public class Person
{
public string FirstName { get; set; } = string.Empty;
public string LastName { get; set; } = string.Empty;
public DateTime? BirthDate { get; set; }
}
}
Regards,
Dimo
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hi Stewart,
Thank you for sharing the sample REPL. Indeed, I have closely examined it and I can conclude that this should rather be considered a browser bug. I have modified the example to use a plain div with display: flex CSS rule and the print does not execute correctly.
A similar topic has been discussed in this SO thread. What I can recommend is that you stick with the non-empty div element.
Kind regards,
Tsvetomir
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hi Tsvetomir,
I have created as simple of an example as possible.
https://blazorrepl.telerik.com/mGEinvFE12pftWC840
just click print
Regards
Stewart
Hi Stewart,
Thank you for sharing the approach that you have undertaken to hide the buttons. Indeed, supplying an empty FormButtons attribute will result in having an empty div HTML element with no buttons. I am not completely sure how this might be affecting the print functionality of the page.
Is it possible for you to share additional details on how exactly the page is printed and, ideally, a sample where the defect can be observed?
Looking forward to your reply.
Kind regards,
Tsvetomir
Progress Telerik