Articles in this section
Category / Section

How to avoid the Flashing or popping effect in ASP.NET WebForms?

2 mins read

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.

 

 

Note:

A new version of Essential Studio for ASP.NET is available. Versions prior to the release of Essential Studio 2014, Volume 2 will now be referred to as a classic versions.The new ASP.NET suite is powered by Essential Studio for JavaScript providing client-side rendering of HTML 5-JavaScript controls, offering better performance, and better support for touch interactivity. The new version includes all the features of the old version, so migration is easy.

The Classic controls can be used in existing projects; however, if you are starting a new project, we recommend using the latest version of Essential Studio for ASP.NET. Although Syncfusion will continue to support all Classic Versions, we are happy to assist you in migrating to the newest edition.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls. If you have any queries or require clarifications, please let us know in the comments section below.

You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied