Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 697487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:10:23+00:00 2026-05-14T03:10:23+00:00

I am using jquery with asp.net webforms….. I am using asp.net pagemethods and jquery….

  • 0

I am using jquery with asp.net webforms….. I am using asp.net pagemethods and jquery….

I am emptying a div on click of anchor tags and filling it with new content…. What happens is my div flickers when my new data is loaded to it… How to avoid this in jquery?
Can i use any effect for this….

<script type="text/javascript">
        $(document).ready(function() {
            getRecordspage(1, 5);
            $("a.page-numbers").click(function() {
            $("#ResultsDiv").empty();
                getRecordspage($(this).text(), 5)
            });
        });

</script>

and my page,

<body>
    <form id="form1" runat="server">
    <div id="ResultsDiv">

</div>
<div class="pager">
<a ID="lnkbtn0" class="page-numbers" href="javascript:void(0);">1</a>
<a ID="lnkbtn1" class="page-numbers" href="javascript:void(0);">2</a>
<a ID="lnkbtn2" class="page-numbers" href="javascript:void(0);">3</a>
<a ID="lnkbtn3" class="page-numbers" href="javascript:void(0);">4</a>
</div>

    </form>
</body>

and my getRecordspage() function is

function getRecordspage(curPage, pagSize) {
    $.ajax({
        type: "POST",
        url: "Default.aspx/GetRecords",
        data: "{'currentPage':" + curPage + ",'pagesize':" + pagSize + "}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(jsonObj) {
            var strarr = jsonObj.d.split('##');
            var jsob = jQuery.parseJSON(strarr[0]);
            $.each(jsob.Table, function(i, employee) {
                $('<div class="resultsdiv"><br /><span class="resultName">' + employee.Emp_Name + '</span><span class="resultfields" style="padding-left:100px;">Category&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Desig_Name + '</span><br /><br /><span id="SalaryBasis" class="resultfields">Salary Basis&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.SalaryBasis + '</span><span class="resultfields" style="padding-left:25px;">Salary&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.FixedSalary + '</span><span style="font-size:110%;font-weight:bolder;padding-left:25px;">Address&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Address + '</span></div>').appendTo('#ResultsDiv');
            });
            $(".resultsdiv:even").addClass("resultseven");
            $(".resultsdiv").hover(function() {
                $(this).addClass("resultshover");
            }, function() {
                $(this).removeClass("resultshover");
            });
        }
    });

 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:10:24+00:00Added an answer on May 14, 2026 at 3:10 am

    you should try to build the Html first in the loop, and append it only once to the dom. That way you will not redraw for each employee.

    EDIT:

    What I would have is a variable where you store the blank html line that you insert for each employee

        var allEmployees;
    
        var empLine = $('<div class="resultsdiv">
        <br />
        <span class="resultName"></span>
        <span class="resultfields" style="padding-left:100px;">Category&nbsp;:</span>&nbsp;
        <span class="resultfieldvalues"></span>
        <br />  
        <br />
        <span id="SalaryBasis" class="resultfields">Salary Basis&nbsp;:</span>&nbsp;<span class="resultfieldvalues"></span>
        <span class="resultfields" style="padding-left:25px;">Salary&nbsp;:</span>&nbsp;
        <span class="resultfieldvalues">' + employee.FixedSalary + '</span>
        <span style="font-size:110%;font-weight:bolder;padding-left:25px;">Address&nbsp;</span>&nbsp;
        <span class="resultfieldvalues"></span>
    </div>')
    

    Then, in the loop, you insert all the data of your employee in the correct places of this html chunk by using jquery selectors and functions and you append this line to the allEmplyee variable.

    After the loop, you can add the styles to these lines (even and odd lines for example) and finally, you inject the allEMployee variable that holds all the results into the page.
    I think that should do it… but I’m no jquery master, just a beginner 🙂
    if that takes some time, then you should probably display an ajax loader gif, it’s important to show that your app is doing something, or your user will start clicking around while waiting.

    http://preloaders.net/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building a asp.net webforms (3.5 sp1) application, using jquery where I can
i have been building websites using vs 2008 (mostly asp.net mvc, jquery and webforms).
I'm using ASP.NET webforms and lots of javascript/jQuery. I'm looking for a really simple
I have an ASP.net webforms site, using jQuery to trigger script methods in asmx
I have almost completed an ASP.NET webforms website using jQuery Mobile. I am stuck
I am using ASP.NET webforms and jquery validation. I would like to check if
Im using ASP.NET 3.5 and WebForms + jQuery, when I added a UserControl (ACSX)
Problem: jQuery DataTables server-side processing using ASP.NET WebForms. Solution: Darin Dimitrov answered the question
Suppose I'm building a StackOverflow clone using webforms ASP.NET and jQuery. The Question page
I'm using jQuery with ASP.NET 3.5 and the ajaxDotNet plugin. What are the differences

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.