Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2008/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 2008 有可能在用户控件中使用VS 2008 Javascript Intellisense吗?_Visual Studio 2008_Ascx_Javascript Intellisense - Fatal编程技术网

Visual studio 2008 有可能在用户控件中使用VS 2008 Javascript Intellisense吗?

Visual studio 2008 有可能在用户控件中使用VS 2008 Javascript Intellisense吗?,visual-studio-2008,ascx,javascript-intellisense,Visual Studio 2008,Ascx,Javascript Intellisense,我已经有一段时间不停地用我的头撞这个了。我似乎无法让intellisense在ascx用户控件中工作,但它在普通的旧aspx中工作良好 以下是aspx页面示例: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestScriptLoader._Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0

我已经有一段时间不停地用我的头撞这个了。我似乎无法让intellisense在ascx用户控件中工作,但它在普通的旧aspx中工作良好

以下是aspx页面示例:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="TestScriptLoader._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="scriptManager" ScriptMode="Debug" runat="server" >
        <Scripts>
            <asp:ScriptReference Path="http://ajax.microsoft.com/ajax/beta/0910/Start.js" ScriptMode="Inherit" />
        </Scripts>
    </asp:ScriptManager>

    </form>
    <script type="text/javascript">

    </script>
</body>
</html>

一旦我更新了javascript intellisense(CTR+SHIFT+J),我就在那里的脚本标签中获得了MicrosoftJax的intellisense

在ascx文件中

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Test.ascx.cs" Inherits="TestScriptLoader.Test" %>

<asp:ScriptManagerProxy ID="scriptManagerProxy" runat="server">
    <Scripts>
        <asp:ScriptReference Path="http://ajax.microsoft.com/ajax/beta/0910/Start.js" ScriptMode="Inherit" />
    </Scripts>
</asp:ScriptManagerProxy>

<script type="text/javascript">

</script>

我没有得到这样的快乐

我能想到的唯一一件事是在一个单独的JS文件中为用户控件编写所有代码,但是在特定的用户控件中,我想要的功能与我将为它们编写的javascript有一对一的映射,并且用户控件在一个页面中只会出现一次。基本上我不想走这条路,如果不是绝对必要的话

编辑

我还需要能够向这些控件添加服务引用,并使intellisense可用

编辑

我突然想到,我遇到的问题是,我在用户控件中使用了scriptmanagerproxy。usercontrol无法知道它与哪个ScriptManager关联,因此javascript intellisense没有更新

我可以通过将scriptmanagerproxy更改为scriptmanager控件来验证这一点,intellisense可用于脚本和服务引用

编辑

我还以为我可以在页面上粘贴一个用鳄鱼夹包裹的

<% if(false) { %>
    <asp:ScriptManager ID="fakeScriptManager" runat="server"/>
<% } %>


<asp:ScriptManagerProxy ID="scriptManagerProxy" runat="server">
    <Services>
        <asp:ServiceReference Path="~/path/to/your.svc" />
    </Services>
</asp:ScriptManagerProxy>

这似乎是可行的,但是
并没有阻止控件的生成


关于如何实现这一点有什么想法吗?

尝试将其添加到ascx顶部的某个位置(使用实际的jquery文件位置)

这篇博文的作者Jouni Heikinemi获得了赞誉:
由于这个问题已经过时,我将在这里给出答案


不可能。原因是VisualStudio无法知道scripmanagerproxy应该引用哪个scriptmanager控件,因此它不会引用任何脚本管理器。因此,编辑控件时intellisense不可用。

对不起,我没有把问题说清楚。我希望能够使用scriptmanagerproxy生成这个intellisense,它可以在aspx页面中工作,但不能在ascx中工作。我需要它来允许我同时使用脚本引用和服务引用。此外,顾在他的页面上发布了这篇文章,描述了这个问题
<% if (false) { %><script type="text/javascript" src="../../Scripts/jquery-