1

Here's a part of my aspx page:

<span id="drag">This can be dragged </span>
<input id="save" type="button" value="Save" />
<div id="dialog">
</div>

<script src="Scripts/jquery.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.9.0.custom.js" type="text/javascript"></script>
<script src="Scripts/ui.js" type="text/javascript"></script>

And here's my ui.js file:

$('#save').click(function ()
{
  $('#dialog').dialog();
});

$(document).ready(function ()
{
  $('#drag').draggable();
});

And I've linked the css file in my masterpage :

    <link rel="stylesheet" href="CSS\ui-lightness\jquery-ui-1.8.24.custom.css">

If I try this in a plain html file I get both draggable and dialog functionalities to work but neither function works when I try it in my aspx page.Is there a special consideration with ASP.NET?

4

4 回答 4

1

You probably loading 2 times the jquery library.

remove this resource :

于 2012-10-09T09:24:58.893 回答
1

What does the rendered HTML look like? Maybe you have a problem with rendered ID of your controls Here's an article about clientId Mode

ClientIDMode can take the following four possible values

  • AutoID - ASP.NET generate IDs as it does in v3.5 and earlier versions.
  • Static - ASP.NET use exactly the same ID given to the server control for its client-side ID.
  • Predictable - ASP.NET try to generate IDs that are guessable from looking at the structure of the page.
  • Inherit - ASP.NET generate a client-side ID for the page or control using the same ClientIDMode as its parent. i.e. the client ID gets inherited from the parent control.

This one can be set in the control directly, in the page or in the webConfig file.

于 2012-10-09T09:25:21.183 回答
1

are all the files being downloaded? did you check this with fiddler, firebug or developer tools?

于 2012-10-09T09:25:37.643 回答
0

If you are not getting any error in browser's console then u should use "jQuery" instead of "$" symbol

于 2012-10-09T09:34:22.493 回答