UserControl does not have public property named ContentTemplate

后端 未结 2 630
后悔当初
后悔当初 2020-12-10 14:54

This question has been asked a few dozen times before; but has never been solved.

i have an UpdatePanel



        
相关标签:
2条回答
  • 2020-12-10 15:12

    The update panel is really cool but you really can't make user controls with it. The good news is you can make asp.net user controls that have a javascript payload by following the same design pattern used to make the updatepanel for the ajaxcontroltoolkit.

    I built this back in Mar 2009 because I needed a message box that didn't block the ui. I followed the design pattern for usercontrols using the ajaxcontroltoolkit. It has complete source and the VS intelisense works on the javascript. It's a usercontrol that you just drop on the page and it carries it's own javascript payload that you can ajaxify to your hearts content. It even works in a data repeater with no modifications. It was actually accepted as a ajaxcontroltoolkit usercontrol on the website asp.net.

    It's free you could put it on github or other repository if you wanted.

    http://gosylvester.com/downloads/messagebox.aspx

    http://gosylvester.com/blog.aspx?id=55

    0 讨论(0)
  • 2020-12-10 15:16

    You should solve this per design.

    Put your update panel on a page and make the user control without an update panel.

    reason: the update panel is intended to autogenerate clientside scripting for asyncronous postback as you surely know. The user control is a building block with a self contained functionality encapsulating complexity which should be placeable anywhere without requirements to the context and in this case at least you would need a scriptmanager on the page which instantiates the control.

    0 讨论(0)
提交回复
热议问题