开发者

Is it possible to create a .ascx virtually? i.e. not on disk, but as a string?

I was wondering if开发者_如何转开发 it was possible to load a asp.net control (.ascx) that doesn't reside on the file system?

Like say a string variable?


Not a string varible but you can load it from resources or zip file, but you have to have full trust. Google for VirtualPathProvider.

As of 4.0 you don't have to have full trust.


System.Reflection.Emit

Assembly.Load(byte[])

No designer for you if you do this though.


You could try this:

string controlString = //read or build it
Control control = this.Page.TemplateControl.ParseControl(controlString);

More information is available here:

http://msdn.microsoft.com/en-us/library/kz3ffe28.aspx

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜