将 .ASCX 项目添加到站点地图
有没有办法将 .ascx 文件添加到站点地图,以便根据上次访问的控件加载/卸载控件?问题是我有一个页面,其中包含一些相互放置的控件,我希望能够使用站点地图在它们之间跳转,而不是为它们创建一个新页面...这就是我的内容我试图将其放入站点地图中,但没有成功(请参阅产品列表、产品详细信息):
<siteMapNode url="Default.aspx" title="Home" description="Home Page of _____">
<siteMapNode url="UserFunctions/ChangePassword.aspx" title="Change Password" description="Change Password" />
<siteMapNode url="Setup/EditUsers.aspx" title="Edit Users" description="Edit Users" />
<siteMapNode url="Setup/EditOther.aspx" title="Edit Other" description="Edit Other" />
<siteMapNode url="DataEntry/EditPartners.aspx" title="Partners" description="Partners">
<siteMapNode url="WebControls/Product List.ascx" title="Product List" description="Product List" >
<siteMapNode url="WebControls/ProductDetail.ascx" title="Product Detail" description="Product Detail" />
</siteMapNode>
</siteMapNode>
</siteMapNode>
Is there a way to add .ascx files to a sitemap such that it will load/unload the controls based on the last ones visited? The problem is i have a page that contains a few controls that get placed under one another, and i'd like to just be able to jump between them with the sitemap instead of creating a new page for them... this is what i'm trying to put into the sitemap without luck (see Product List, Product Detail):
<siteMapNode url="Default.aspx" title="Home" description="Home Page of _____">
<siteMapNode url="UserFunctions/ChangePassword.aspx" title="Change Password" description="Change Password" />
<siteMapNode url="Setup/EditUsers.aspx" title="Edit Users" description="Edit Users" />
<siteMapNode url="Setup/EditOther.aspx" title="Edit Other" description="Edit Other" />
<siteMapNode url="DataEntry/EditPartners.aspx" title="Partners" description="Partners">
<siteMapNode url="WebControls/Product List.ascx" title="Product List" description="Product List" >
<siteMapNode url="WebControls/ProductDetail.ascx" title="Product Detail" description="Product Detail" />
</siteMapNode>
</siteMapNode>
</siteMapNode>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,用户控件仅存在于页面内;您可以引用product.aspx?category=,因此您可以在站点地图中定义一个查询字符串值,并根据该值动态加载正确的用户控件。这可以工作,但不能直接引用用户控件。
HTH。
No, a user control only lives within the page; you could have a reference to product.aspx?category=, so you'd define a querystring value in the sitemap, and dynamically load the correct user control based upon that value. That would work, but not referencing a user control directly.
HTH.