Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 29th, 2004, 06:58 PM
Authorized User
 
Join Date: Sep 2003
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default Intellisense for UserControl

Simply stated, my question is: How does one enable intellisense for user controls?

Recently, I have been trying to learn the ins-and-outs of user controls. I seem to be able to get them to work properly inside an application; however, I can't figure out how to turn on intellisense for any control I create. For instance:

CompanyHeader.ascx
==================

  <%@ Control Language="c#"
      AutoEventWireup="false"
      Codebehind="CompanyHeader.ascx.cs"
      Inherits="MyWebsite.CompanyHeader"
      TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>

  <h2>MyCompanyName</h2>

  <p></p>

TestCompanyHeader.aspx
======================

  <%@ Register TagPrefix="MyCompany"
      TagName="Header"
      Src="CompanyHeader.ascx" %>

  <%@ Page language="c#"
      Codebehind="TestCompanyHeader.aspx.cs"
      AutoEventWireup="false"
      Inherits="MyWebsite.TestCompanyHeader" %>

  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
  <html>
    <head>
      <title>TestCompanyHeader</title>
      <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
      <meta name="CODE_LANGUAGE" Content="C#">
      <meta name=vs_defaultClientScript content="JavaScript">
      <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
    </head>
    <body >
      <form id="Form1" method="post" runat="server">
        <MyCompany:Header id="MyCompanyHeader" runat="server"></MyCompany:Header>
        <asp:button id="btnSubmit" text="Submit" runat="server"></asp:button>
       </form>
    </body>
  </html>

==========

When I type the following:

  <asp:button...

intellisense (including "asp" items) pops up without problem. When I type the following, however:

  <MyCompany:Header...

itellisense pops up, but nothing for "MyCompany" appears within the intellisense. Is there a way to add intellisense for a user control? Thanks.

- Roger Nedel
__________________
Cheers.

- Roger Nedel
 
Old May 1st, 2004, 07:44 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Do a search on the forums for the user "bmains". He seems to do a lot with user and server controls and may have some posts related to this question.
 
Old May 3rd, 2004, 05:50 AM
Authorized User
 
Join Date: Sep 2003
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks planoie...I'll take a look.

- Roger Nedel

- Roger Nedel

Nedel Software Solutions
rnedel@nedelsoft.com
 
Old May 3rd, 2004, 06:16 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

There used to be an article about this located here:
http://www.intelliprog.com/articles/index.html

Currently, the site is not up and I don't know if it's gone for good.

Anyway, adding design-time intelli-sense isn't a straight forward process. You should modify the file asp.xsd (or create your own, not sure) located here: Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\schemas\xml

That file defines the properties etc that controls expose to the designer. You can change this file if you want to add or remove support for intelli sense for existing properties. Unfortunately, I cannot recall the exact steps you need to perform to add intelli sense support for your controls, but I am sure that a search on Google for asp.xsd will bring up some useful results.

UPDATE: This article describes how to add intelli-sense: http://www.codeproject.com/aspnet/ExpandingDiv.asp to your controls.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Flesh and Bone by Hed Planet Earth (Track 10 from the album: Blackout ) What's This?
 
Old May 3rd, 2004, 07:30 PM
Authorized User
 
Join Date: Sep 2003
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Imar:

Thank you. I just clicked on the link you provided. Fortunately, the site is back up. I appreciate your assistance.

- Roger Nedel

 
Old May 4th, 2004, 02:00 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

After reading your post again, I realized you're asking for Intelli Sense support from an ascx user control.

Unfortunately, I don't think that is going to work with the links I provided. A User Control will expose its properties in Intelli Sense for code you create in the Code Behind of the control. Inside other controls and pages you'll see Intelli Sense appear if you create a strongly typed version of your control.
However, I am afraid that for the ASPX part of a page, you won't get Intelli Sense. You'll have to create your own server controls combined with the stuff from the articles I pointed you to to get correct Intelli Sense.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old June 15th, 2004, 04:47 AM
Registered User
 
Join Date: Mar 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You seem to want http://www.bluevisionsoftware.com/We...msIntellisense

Use their generator tool (linked at end of article), and generate an xsd file for each of your control tagprefixes (for example, I have a user controls one and a server-side user controls one, for historic reasons I don't want to get into 'cos they'd show how new I was at ASP.NET ;) ).

Put those in Program Files\Microsoft Visual Studio .NET 2003\Common7\Packages\schemas\xml

In the head node of the documents that you want intellisense in (<body> for pages/webforms, but in .ascx controls, the first tag of the control), put xmlns:Var1="urn:Var2", where
Var1 is the tagprefix of controls (from <%@ Register TagPrefix="XrmHelp" ...%> statements)
Var2 is the namespace of the xsd, which apparently is usually a url because they're more likely to be unique.

I would love to know if it's possible to put these xmlns links in someplace that doesn't get output to the client-side page, but I don't know how to do that yet, or if it's possible at all. If it is, please someone let me know! ;)

{edit} Oh yeah - in an ideal world of course, someone will modify the generator tool so that it can take command-line arguments and thus be used in the build process to regenerate the xsd files upon recompilation so that changes are propagated to intellisense...





Similar Threads
Thread Thread Starter Forum Replies Last Post
BizObject class - Intellisense? ViagraFalls BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 September 19th, 2007 02:24 PM
javascript intellisense & session object VictorVictor ASP.NET 2.0 Professional 0 March 29th, 2007 10:59 AM
Assembly wont show in intellisense Aerosol ASP.NET 2.0 Basics 0 April 23rd, 2006 12:26 PM
Refresh UserControl jpfree71 ASP.NET 1.0 and 1.1 Basics 3 August 17th, 2004 12:31 PM
Intellisense stopped working in InterDev 6 riga1966 Classic ASP Professional 3 June 1st, 2004 05:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.