开发者

Syntax Highlighting for Custom ASP.NET Control

开发者 https://www.devze.com 2023-01-22 05:43 出处:网络
I have built a simple custom ASP.NET control that expects it\'s body content to be javascript. Is there a way to tell Visual Studio that the content should be javascript, and therefore provide syntax

I have built a simple custom ASP.NET control that expects it's body content to be javascript. Is there a way to tell Visual Studio that the content should be javascript, and therefore provide syntax highlighting / intellisense goodness?

In case it helps, here's the framework of the control I'm working with.

namespace MyNamespace
{
    public class M开发者_StackOverflow中文版yControl : Control
    {
        public override void RenderControl(HtmlTextWriter writer)
        {
            // Do Stuff
        }
    }
}

And it's usage in a page:

<prefix:MyControl runat="server">
    function someFunction(){...}
</prefix:MyControl>

I'm hoping that there's simply an attribute I can add to the class.


That's going to be hard to support, it would be easier to allow the tag, and have your control essentially wrap the script... Out of the box, you may be able to inherit from WebControl, and change the TagName property to return a script tag, but out of the box I don't think what you are asking to do is possible with intellisense support. Without intellisense, sure it will all work fine at runtime.

0

精彩评论

暂无评论...
验证码 换一张
取 消