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

  • Home
  • SEARCH
  • 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 7929379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:03:20+00:00 2026-06-03T20:03:20+00:00

edit: after i update the latest code and now i see there are two

  • 0

edit:
after i update the latest code and now i see there are two “characters count” instead of showing only one.
does it mean its executing twice the same code? document.ready and add_endrequest?

  $('[id*="txtNewComments"]').charCount({
            allowed: 300,
            warning: 15,
            counterText: 'Characters left: '
        });

i am using asp.net page with updatepanel and some jquery when i start using updatepanel my jquery and javascript function stop working and i dont see any action … after i searched i found this: jQuery $(document).ready and UpdatePanels? link which is very informative but i have a question.

below is the code that does not work if i have a updatepanel…

$(document).ready(function() {

     $('[id*="txtNewComments"]').charCount({
            allowed: 300,
            warning: 15,
            counterText: 'Characters left: '
        });

     ..........
     ..........
});

//update:

function UpdateEmployee(....) {}

so if i go ahead with the recommended way then i have to have two set of each script one is within the docuement.ready and other set of script is with in the endRequest some thing like this below is working with update panel if i follow this pattern.

$(document).ready(function() {
    // bind your jQuery events here initially
});

var prm = Sys.WebForms.PageRequestManager.getInstance();

prm.add_endRequest(function() {
    // re-bind your jQuery events here
});

my question is: is there a way to have one set of script rather then one in document.ready and another in endrequest ?… its a pain to maintain two set of scripts.

any thoughts?

update with update panel

<asp:ScriptManager runat="server" />
    <asp:UpdatePanel runat="server">
        <ContentTemplate>
            <asp:Repeater runat="server" ID="Repeater1" OnItemCommand="OnItemCommand" OnItemDataBound="OnItemDataBound">
                <HeaderTemplate>
                    <table border="0" cellpadding="0" cellspacing="0">
                        <tr>
                            <th></th>
                            <th>First Name</th>
                            <th>Last Name</th>
                        </tr>
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <asp:ImageButton ID="Edit" ImageUrl="~/Images/EditDocument.png" runat="server" CommandName="edit" />
                            <asp:ImageButton ID="Delete" ImageUrl="~/Images/Delete_black_32x32.png" runat="server"
                                CommandName="delete" />
                        </td>
                        <td>
                            <asp:Label runat="server" ID="firstName"><%# Eval("FirstName") %></asp:Label>
                            <asp:PlaceHolder runat="server" ID="firstNameEditPlaceholder" />
                            <input type="hidden" runat="server" id="firstNameHidden" visible="false" />
                        </td>
                        <td>
                            <asp:Label runat="server" ID="lastName"><%# Eval("LastName") %></asp:Label>
                            <asp:PlaceHolder runat="server" ID="lastNameEditPlaceholder" />
                            <input type="hidden" runat="server" id="lastNameHidden" visible="false" />
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    <tr>
                        <td>
                            <asp:ImageButton ID="Delete" ImageUrl="~/Images/112_Plus_Blue_32x32_72.png" runat="server"
                                OnClick="OnAddRecord" />
                        </td>
                        <td><asp:TextBox runat="server" ID="NewFirstName" /></td>
                        <td><asp:TextBox runat="server" ID="NewLastName" /></td>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
        </ContentTemplate>
    </asp:UpdatePanel>
  • 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-06-03T20:03:21+00:00Added an answer on June 3, 2026 at 8:03 pm

    Try this:

    $(document).ready(function() {
        bindJqueryFeatures();
    });
    
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    
    prm.add_endRequest(function() {
        bindJqueryFeatures();
    });
    
    
    function bindJqueryFeatures(){
        //bind your jQuery events here initially 
    }
    

    Now, if you want to change or add some jQuery features just insert code in bindJqueryFeatures() function so you don’t need to dublicate your code in both methods: $(document).ready() and prm.add_endRequest().

    Also it can be usefull.

    Is that what you need?

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

Sidebar

Related Questions

How can I edit this to run only once after user scroll up: (function
Edit note: After a seemingly enourmous amount of bad feedback MS got from their
I'm trying to immediately set a row to Edit mode after it is created.
Possible Duplicate: Saving changes after table edit in SQL Server Management Studio I need
EDIT 1 I apologize but after reading the 2 suggested articles I still don't
EDIT: This post was originally specific to ASP.NET, but after thinking about it I'm
[EDIT] I am changing this to more concisely explain what my problem was, after
I need edit my Images before they import to the app but after editing
I'm going to edit an ImageField using jquery ajax,after searching I found out I
Edit: Prepare my objects for the use within a HashMap. after reading a bit

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.