Passing in content to ASP.NET user control

瘦欲@ 提交于 2019-12-24 06:30:11

问题


I have a UserControl named BreadCrumb. I would like to pass in information to this user control like so (Similar to DropDownList items):

<uc:BreadCrumb runat="server" id="HeaderBreadCrumb">
    <AddLevel Name="Home" Url="~/Default.aspx" />
    <AddLevel Name="About Us" Url="~/AboutUs.aspx" />
</uc:BreadCrumb>

Thanks to any help!


回答1:


Please take a look here How to: Create an ASP.NET User Control and here Implementing Custom UserControl with ListItem collection. These approaches doesn't uses templates.




回答2:


You can support templates, but that's not exactly what you are after.

Take a look at this Scott Guthrie page for more information on using templates on user controls.

Also, take a look at this MSDN page on how to create templated user controls.



来源:https://stackoverflow.com/questions/1971498/passing-in-content-to-asp-net-user-control

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!