views:

390

answers:

2

in a web form I'm trying to get intellisense within a script tag BUT within some inline .net code Running vstudio 2008 / c# / .net 3.5 / vista

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" 
Inherits="adazzle.mediaApp.adazzleMediaAppWeb.controls.WebUserControl1" %>
<%@ Register src="utils/popup.ascx" tagname="popup" tagprefix="uc1" %>
<div>
<%=popup1.ClientID;%>
<script language="javascript" type="text/javascript">
 var popId = <%="'" + popup1.ClientID%>';//no inetllisense here
 //this wont work either
 <%
 string popid = popup1.ClientID; 
 //no intellisense here either - thinks it is javascript
 %>
</script>
    <uc1:popup ID="popup1" runat="server" />    
</div>

I get intellisense in the first angle bracket, but within the script tag intellisense is picking up javascript intellisense - ie not recognising that I am actually doing some inline code. Is there a syntax I can use to get this??

A: 

I don't know that this will fix it for you, but one part of the problem is that you're inside a javascript string literal. See if doing it this way helps:

<script language="javascript" type="text/javascript">
 var popId = <%="'" + adzPopup1.ClientID%>';
</script>
Joel Coehoorn
good idea but afraid that wasnt it. have edited post to fix that / more clearly demo what wont work
A: 

For 2003 it seems this was a recognised issue

Not sure about 2008... but someone here has the same issue with MVC inline code, and the solution was to include

<%@ Import Namespace="System.Web.Mvc.HtmlHelper" %>

in the .aspx page. Unfortunately I'm not sure what the equivalent for what you need would be.

edit: just read on MSDN - When IntelliSense Is Unavailable, that IntelliSense is unavailable when in a string literal - this could be your problem.

Zeus