Reputation: 21
I made a simple application to show a dialog with jQueryUI in VS 2008. This succeeded. When I try the same in VS 2010 nothing happens. It seems that ASP cannot get the jQuery library because when I do the following, no alert is shown when button dialog_link
is pressed:
<script type="text/javascript">
$(document).ready(function() {
// Dialog Link
$('#dialog_link').click(function() {
alert("hello");
return false;
});
});
</script>
I put the following two lines within <head>
tag:
<script type="text/javascript" src="js/jquery-1.5.2.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.11.custom.min.js"></script>
Upvotes: 1
Views: 3596
Reputation: 9242
Working just fine, here is a live sample on JsFiddle: http://jsfiddle.net/Wh4PU/
100% the problem will be in the include tag of the jQuery file, can you post your script tags as well ?
Update: I'm suspecting that the file is not included, can you use the following script tags and try again?:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js" ></script>
Upvotes: 0
Reputation: 30488
How does the rendered HTML look? I suspect, the html IDs are differing from VS2008 to VS2010.
ASP.NET 4 supports a new ClientIDMode property on the Control base class. The ClientIDMode property indicates how controls should generate client ID values when they render. The ClientIDMode property supports four possible values:
- AutoID—Renders the output as in .NET 3.5 (auto-generated IDs which will still render prefixes like ctrl00 for compatibility)
- Predictable (Default)— Trims any “ctl00” ID string and if a list/container control concatenates child ids (example: id=”ParentControl_ChildControl”)
- Static—Hands over full ID naming control to the developer – whatever they set as the ID of the control is what is rendered (example: id=”JustMyId”)
- Inherit—Tells the control to defer to the naming behavior mode of the parent container control
Upvotes: 2