I have a page that loads a playlist of songs. The individual songs in the playlist are capable of being dragged around the playlist with jquery. The page also incorporates server side sorting with an ajax update panel. the problem is that after i do a server side sort, the jquery methods don't work anymore.
do the jquery methods get re-attached to the document after the asp.net ajax panel updates the page?
There is a problem exists if we are using an updatepanel.So we need to add the javascript from server side each time the page loads .this can be done by adding all your javascript codes in to a string variable and adds it using ScriptManager.RegisterStartupScript(this, this.GetType(), "validation", script, false);
Please go to http://msdn.microsoft.com/en-us/library/system.web.ui.scriptmanager.registerstartupscript.aspx/" to get more information about the function and its arguments.
You can make a function like this
private void addScript()
{
string script = @"<script type=""text/javascript"" language=""javascript"">
javascript function including jquery
</script>";
ScriptManager.RegisterStartupScript(this, this.GetType(), "validation", script, false);
}
All the javascript function will be added in the string script
.
Call the function in pageload.So it will again adds to the page.
I think this will solves the problem.