CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_studio_2005 Tags:
Item Type: NewsGroup Date Entered: 1/15/2007 1:50:51 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 15 Views: 40 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
16 Items, 1 Pages 1 |< << Go >> >|
speednet
Asp.Net User
Getting Intellisense and validation to recognize new tags1/15/2007 1:50:51 PM

0/0

Hello,

I have a custom web control I've built, which uses child controls to build properties of the control.  (Like a DropDownList uses ListItem controls to build the list.)

The control looks like this:

<ns:MyControl ID="Main" runat="server">
	<Property1 Color="#fff" Text="Test content" />
	<Property2 Color="#000" Text="Second Test" />
</ns:MyControl>
The control is working perfectly.  However, Intellisense is not working for the child controls, and the VS validation is putting a red squiggly underline under the child tags names and property names.  (I tried to simulate above.)

I know there is a way to fix it, but the Microsoft documentation on this is incredibly confusing, and it seems there must be a better way.

This is all I found on the subject: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ASPNet-AddDesignTimeSupport.asp

          (Scroll down to HTML View Support: Custom Schemas and Visual Studio Annotations)

Any help on how to do get Intellisense working for the child controls, and getting the validator to recoignize the child tags and properties would be greatly appreciated!


http://blogs.lotterypost.com/speednet
Mikhail Arkhipo
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/15/2007 6:39:31 PM

0/0

There is a limitation in how deep intellisense engine goes fetching types for a control. It does can find base class in a different assembly, but not a class that, say, represent a collection within the control. If you derive your control from an existing control you also have to make new inner property or collection class as well deriving them from the corresponding type in the base class. For example, if base is a Table and you derive myTable, you also have to derive myCell from Cell and myColumn from Column classes for the intellisense to find them.
Thanks

------------------------------------------------------------

This posting is provided "AS IS" with no warranties, and confers no rights.
speednet
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/15/2007 6:59:17 PM

0/0

Mikhail Arkhipov (MSFT):
There is a limitation in how deep intellisense engine goes fetching types for a control. It does can find base class in a different assembly, but not a class that, say, represent a collection within the control. If you derive your control from an existing control you also have to make new inner property or collection class as well deriving them from the corresponding type in the base class. For example, if base is a Table and you derive myTable, you also have to derive myCell from Cell and myColumn from Column classes for the intellisense to find them.

Well, the control I created is not derived from anything other than "Control".  The child controls are parsed by the control with a ControlBuilder attribute and methods.  So I don't think VS will pick up any info about the Child controls unless I document them somehow.  The link I posted was a consufing article that seemed to suggest that I should create an XML namespace document, but gave no examples and no real detail about doing it. 

Any other ideas?


http://blogs.lotterypost.com/speednet
Mikhail Arkhipo
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/15/2007 7:13:46 PM

0/0

The article is about VS 2003. VS 2005 reflects on control assemblies and generates XML schemas for intellisense automatically.
Thanks

------------------------------------------------------------

This posting is provided "AS IS" with no warranties, and confers no rights.
Mikhail Arkhipo
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/15/2007 7:14:55 PM

0/0

How exactly Property1 is defined in C# or VB code?
Thanks

------------------------------------------------------------

This posting is provided "AS IS" with no warranties, and confers no rights.
speednet
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/15/2007 7:30:05 PM

0/0

Here is a skeleton of the program code, with properties and irrelevant code stripped out.

<ControlBuilderAttribute(GetType(MyControlParseControlBuilder)), ToolboxData("<{0}:MyControl runat=server></{0}:MyControl>")> _
Public Class MyControl : Inherits Control : Implements INamingContainer
	'Properties defined here...

	Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
		'Rendering code here...
	End Sub

	Protected Overrides Sub AddParsedSubObject(ByVal obj As Object)

		If (TypeOf obj Is MyControlItem1) Then
			'Process property1...
		ElseIf (TypeOf obj Is MyControlItem2) Then
			'Process property2...
		End If

	End Sub

End Class

Public NotInheritable Class MyControlParseControlBuilder : Inherits ControlBuilder

	Public Overrides Function GetChildControlType(ByVal TagName As String, ByVal attributes As IDictionary) As Type

		'MyControlItem1 & 2 are classes defined elsewhere...
		If (String.Compare(TagName, "Property1", True) = 0) Then
			Return GetType(MyControlItem1)
		ElseIf (String.Compare(TagName, "Property2", True) = 0) Then
			Return GetType(MyControlItem2)
		End If

		Return Nothing
	End Function

	Public Overrides Sub AppendLiteralString(ByVal s As String)
	End Sub

End Class

 
http://blogs.lotterypost.com/speednet
toddgrun
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/16/2007 5:10:55 PM

0/0

Unfortunately, the editor isn't able to use the ControlBuilder to determine what the control persistence should be. (Property1 and Property2 are not really visible for inspection) Would it be possible to statically declare your inner properties instead of using a ControlBuilder? Our intellisense engine is able to handle static properties persisted as inner markup, but it isn't able to handle the dynamic markup scenario.

Thanks.


Todd Grunke

------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
speednet
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/16/2007 5:34:43 PM

0/0

toddgrun:

Unfortunately, the editor isn't able to use the ControlBuilder to determine what the control persistence should be. (Property1 and Property2 are not really visible for inspection) Would it be possible to statically declare your inner properties instead of using a ControlBuilder? Our intellisense engine is able to handle static properties persisted as inner markup, but it isn't able to handle the dynamic markup scenario.

Thanks.

The reason for using the ControlBuilder is that the number of child elements is dynamic.  It could be 1 or 100, or anything in between.  So I don't think there's a way to do it statically.

Seems that there must be a way to document the properties in some fashion, even if I have to figure out how to do it with an XML namespace.  Is there anything I can do?  Is there any documentation someplace that would help me figure it out with an example or two?


http://blogs.lotterypost.com/speednet
toddgrun
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/16/2007 5:39:43 PM

0/0

Can you use a collection of children instead of giving each child property a unique name?
Todd Grunke

------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
speednet
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/16/2007 6:03:08 PM

0/0

Hey, I just figured it out, thanks to Nikhil Kothari!

I needed to add the PersistChildren() attribute to the class definition, as follows:

<ControlBuilderAttribute(GetType(MyControlParseControlBuilder)), PersistChildren(False, True), ToolboxData("<{0}:MyControl runat=server></{0}:MyControl>")> _
Public Class MyControl : Inherits Control : Implements INamingContainer

The first argument (False) indicates that the inner content will be treated as control properties, rather than controls, and the second argument (True) indicates that I am using customized persistence.

http://blogs.lotterypost.com/speednet
toddgrun
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/16/2007 6:12:12 PM

0/0

The PersistChildrenAttribute decorator basically tells us to turn off our intellisense engine inside the control. Note that you won't get any stmt completion for your control's inner markup, whereas if you were able to create a child control collection, you could get intellisense. I'm glad to hear that this solves the issue for you.


Todd Grunke

------------------------------------------------------------
This posting is provided "AS IS" with no warranties, and confers no rights.
speednet
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/16/2007 6:16:59 PM

0/0

Could you please point me to an example of creating a child control collection, so I can understand exactly what you mean?  Thanks....
http://blogs.lotterypost.com/speednet
speednet
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/16/2007 6:54:44 PM

0/0

Nevermind, I just figured that one out too.  There is a good example here: http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx

(Scroll down to "Overriding Control Parsing".)


http://blogs.lotterypost.com/speednet
speednet
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/16/2007 6:54:51 PM

0/0

Nevermind, I just figured that one out too.  There is a good example here: http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx

(Scroll down to "Overriding Control Parsing".)

 
http://blogs.lotterypost.com/speednet
speednet
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/16/2007 6:54:58 PM

0/0

Nevermind, I just figured that one out too.  There is a good example here: http://samples.gotdotnet.com/quickstart/aspplus/doc/webctrlauthoring.aspx

(Scroll down to "Overriding Control Parsing".)

  Thanks for all your
http://blogs.lotterypost.com/speednet
speednet
Asp.Net User
Re: Getting Intellisense and validation to recognize new tags1/16/2007 6:56:17 PM

0/0

Thanks for all your help.  (Got cut off in the last post.)
http://blogs.lotterypost.com/speednet
16 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Visual Web Developer 2005 Express Edition For Dummies Authors: Alan Simpson, Pages: 358, Published: 2005

Web:
Getting Intellisense and validation to recognize new tags - ASP ... Getting Intellisense and validation to recognize new tags. Last post 01-16-2007 1:56 PM by speednet. 15 replies. Sort Posts: ...
Mikhail Arkhipov (MSFT)'s WebLog : How to create custom CSS ... Restart IDE, open CSS file and your new schema should appear in the dropdown. ... Can this same process (customizing the css intellisense & validation) be ...
intellisense Resources | TechRepublic In fact, intellisense cannot recognize the the object's member functions. All references are made and the TLB is... Tags: browser helper object, ...
Feedback: Problems with Intellisense and user controls Intellisense in code window doesn't recognize user controls registered in web. config if the user control tag isn't in the page. Comments ...
Visual Web Developer Team Blog : JScript IntelliSense in Visual ... Jeff King made a recent post to show off the new JScript IntelliSense feature in the ... Argument validation for methods or something completely different? ...
CodeProject: ASP.NET 2.0 and Visual Web Developer Overview. Free ... Dec 6, 2005 ... The source editor provides full Intellisense throughout your files and has new features for navigating and validating your markup. ...
2007 March « Welcome to ViSh’s Blogs NET AJAX Beta1 release - which is that you lose intellisense when you map multiple assemblies against the tag prefix and use the controls within a ...
HTML Validation Checking in VS 2005 (and how to optionally turn it ... Here is a post I did that talks about how to add new validation schemas into your ... Hi Scott Is there a way to cause intellisense to add the asp tag ...
MyEclipse :: View topic - JSP Editor - Unknown Tag I created a new WebProject and I was able to get the editor to recognize ..... Otherwise you may not get the most updated intellisense or editor validation. ...
RSS Feeds Validation? : feed, xml I am actually getting the XML output the browser, somehow some warnings and errors in ..... If they use DOM methods, they'll still have to recognize the new ...




Search This Site:










friendly names

collections and webservices

modules disappear

how to add images to a page?

expand and collapse all webparts on a page

managing the textbox security checks

iis 5.1 -> problem with writing to database asp .net

how to access master page controls?

session_onend vs. session_end and so on...

visual studio 2007 and .net v3.0 for vista

can session variable be placed in as web application class.

perform calculations without postback

transfer file from one server to other server using asp.net

our asp.net 2.0 website has been hacked.

detecting backslash charecters using regularexpressions?

uploading images asp 2.0

printmodule question - how can i make it work?

delegation asp.net to sql server

retrive a file from a binary data field

smart navigation - paneled forms

can't find a hidden space(height) in table cell

validating dynamically generated text boxes

global.asax - going backwards?

free source code of web-shop

document versioning (like sharepoint)

how can i count number of users logged on?

could you help me pleeeeeease !!!

streaming videos

when to initialize settings (hashtable)

acmevb.dll

 
All Times Are GMT