ASP.NET Web用户控件库 [英] ASP.NET Web User Control Library

查看:179
本文介绍了ASP.NET Web用户控件库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一大堆的用户控件我们想拉出一个Web应用程序,并成为一个单独的程序/库,并且我认为这将是为创建一个类库,并拉动ASCX和ascx.cs文件一样简单到项目,并编译DLL给我们的应用程序之间重用。

We have a bunch of user controls we would like to pull out of a web application and into a separate assembly/library, and I thought it would be as simple as creating a class library and pulling the ascx and ascx.cs files into the project, and compiling a DLL to be reused among our applications.

此情况并非如此,但

我们的最终目标是有一个单一的分配DLL(类似于Telerik的如何分配他们的控件),我们可以抛出任何Web应用程序。这里的步骤:打开一个的.ascx用户控件成可再发行自定义控件非常简单跟随然而这导致controlname.ascx.guid.dll名为许多文件,这是不期望的结果。我甚至不能让这些不管怎么说工作,因为我们有一个需要被编译成汇编其他类。

Our ultimate goal is to have a single distributable DLL (similar to how Telerik distributes their controls) that we can throw into any web application. The steps here: Turning an .ascx User Control into a Redistributable Custom Control were very simple to follow, however this results in many files named controlname.ascx.guid.dll, which is not the desired result. I couldn't even get these to work anyways, since we have additional classes that need to be compiled into the assembly.

有没有人成功创建.NET中的Web用户控件库(我们使用3.5这里)?我似乎无法找到一个很好的一步一步的指导。

Has anyone successfully created a web user control library in .NET (we're using 3.5 here)? I can't seem to find a nice step-by-step guide.

推荐答案

如果你想共享项目中的控制,我的经验表明,最好的办法就是建立自定义asp.net服务器控件,而不是用户控件。用户控件是很好的为同一个项目内共享,而不是在多个的。

If you want to share controls among project, my experience has shown that the best way is to build custom asp.net server controls instead of usercontrols. User controls are good for sharing within the same project, but not over multiple ones.

为此,我建议你建立一套自定义服务器控件类库里面使用的所有项目。

For this purpose I suggest you to build a set of custom server controls inside a class library and use that on all of your projects.

<一个href=\"http://books.google.com/books?id=5RfcxwmvRXwC&pg=PA102&dq=asp.net+server+controls&ei=OuKFSsmdFonOzQTauo2GDg#v=onepage&q=&f=false\">This本书确实相当不错的讲解创建服务器控件的基本知识

This book does quite a good job at explaining the basics of creating server controls

编辑:

我目前正在开发一个.NET Web服务器控件库。我其实并没有遵循任何一步一步的指导。我用我上面提到的书和MSDN库+反射,这是检查现有的MS服务器控件和向他们学习一个伟大的工具主要是考虑。


I'm currently developing a .net web server control library. I actually didn't follow any step-by-step guide. I mostly considered using the book I mentioned above and the MSDN library + Reflector, which is a great tool for inspecting existing MS server controls and learning from them.

这篇关于ASP.NET Web用户控件库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆