We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to avoid the Flashing or popping effect during control rendering in ASP and MVC platforms?

Platform: ASP.NET MVC |
Control: General |
Published Date: February 20, 2018 |
Last Revised Date: May 9, 2019

How to avoid the Flashing or popping effect during control rendering in ASP and MVC platforms

 

Cause:

In our ASP.NET and ASP.NET MVC platform, the controls are rendered using tag helpers. During rendering of our controls, these tag helpers get serialized to generate a script which actually renders the control using JavaScript. Since our controls are JavaScript based controls. Now during this process, there is a delay between the tag helpers being serialized and controls being rendered using the generated script. This is delay causes the control to appear flashing or popping from native HTML elements.

 

Solution:

To avoid this flashing or popping from HTML elements effect, a new <div> element can be added to contain the control, with its CSS visibility property set to hidden. Now the control will not be visible in DOM during rendering. Once the control render completes, the create event of the same control can be used to set the visibility property of the <div> element to visible from hidden. Thus, avoiding the controls from being flashing from the HTML elements.

 

Refer to the following example in the ASP.NET WebForms platform,

[ASP]

<div id="container" style="visibility:hidden;">
    <ej:DatePicker runat="server" ID="datepick" Width="100%"></ej:DatePicker>
    <br />
    <ej:NumericTextBox ID="numeric" Name="numeric" runat="server" width="100%" />
    <br />
    <ej:DropDownList ID="selectCar" runat="server" WatermarkText="Select a car" ClientSideOnCreate="oncreate" Width="100%">
        <Items>
            <ej:DropDownListItem Text="Audi A4" Value="Audi A4"></ej:DropDownListItem>
            <ej:DropDownListItem Text="Audi A5" Value="Audi A5"></ej:DropDownListItem>
            <ej:DropDownListItem Text="Audi A6" Value="Audi A6"></ej:DropDownListItem>
            <ej:DropDownListItem Text="Audi A7" Value="Audi A7"></ej:DropDownListItem>
            <ej:DropDownListItem Text="Audi A8" Value="Audi A8"></ej:DropDownListItem>
        </Items>
    </ej:DropDownList>
</div>
<script>
    function oncreate() {
        $("#container").css("visibility", "visible");
    }
</script>

 

Sample link

Note:

Make sure that the Create event is bound to the last Syncfusion control in the page for an optimal experience.

 

Refer to the following example in the ASP.NET MVC platform,

<div id="container" style="visibility:hidden;">
    @Html.EJ().DatePicker("DatePick").Width("100%")
    <br />
    @Html.EJ().NumericTextbox("numeric").Width("100%")
    <br />
    @Html.EJ().DropDownList("selectCar").TargetID("carsList").Width("100%").WatermarkText("Select Value").ClientSideEvents(e => e.Create("oncreate"))
    <div id="carsList">
        <ul>
            <li>Audi A4</li>
            <li>Audi A5</li>
            <li>Audi A6</li>
            <li>Audi A7</li>
            <li>Audi A8</li>
        </ul>
    </div>
</div>
<script>
    function oncreate() {
        $("#container").css("visibility", "visible");
    }
</script>

 

Sample link

Note:

Make sure that the Create event is bound to the last Syncfusion control in the page for an optimal experience.

 

 

2X faster development

The ultimate ASP.NET MVC UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon