1

I have a drop down list and some styles applied to it from two js files, included in head like:

 <script type="text/javascript" src="js/functions.js"></script>
<script type="text/javascript" src="js/jquery.jqtransform.js"></script>

All it's working great when the page is loading for the first time.

But when i do an ajax request on this page the styles applied before, are lost, so i have included the js src files from the code behing like:

 protected void Page_PreRender(object sender, EventArgs e)
{
    loadJs();
}

private void loadJs()
{
    ScriptManager.RegisterClientScriptInclude(this,
        typeof(Page),
        "AlertScript",
        ResolveClientUrl("~/Site/js/jquery.jqtransform.js"));
    ScriptManager.RegisterClientScriptInclude(this,
       typeof(Page),
       "AlertScript2",
       ResolveClientUrl("~/Site/js/functions.js"));
}

But...it's still not working although i see in the broswer - view source that the js files are loaded correctly in the body...

Do you have any suggestion?

Thanks in advance.

1 Answer 1

1

In your ajax return function (on the html page) you need to reapply the jquery commands you run the first time the page loads.

jQuery runs over the DOM and does what you tell it to. When the ajax call returns and replaces a part of the page, all runtime changes for that region are lost, so you need to reapply them.

Basically you need to call whatever function is called in jqtransform.js and in functions.js on page load on the html element which is replaces.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.