ASP.NET 中的下拉列表充满图像?
如何制作一个充满图像项目的下拉列表?我希望能够看到列表中带有文本标题的图像列表,能够专门选择一个图像,并使文本标题出现在列表顶部的选择框中。有谁知道如何实现这一点?
How do I make a drop-down list that is filled with image items? I want to be able to see a list of images in the list with text titles, be able to select one exclusively, and have the text title appear in the selection box on top of the list. Does anyone know how this can be accomplished?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最直接的方法是使用第 3 方库,例如 Telerik 的 ASP.NET AJAX 库(通常称为 Rad Controls)。
http://demos.telerik.com/aspnet- ajax/combobox/examples/functionality/templates/defaultcs.aspx
我在 Telerik 上运气很好。 RadComboBox(ASP.NET 的全功能下拉列表)的一个好处是,如果您愿意,它允许您覆盖列表中每个项目的呈现。通过覆盖每个项目的呈现,您可以将任何类型的 HTML 放入下拉列表中(包括图像、表格等)。所以它是相当强大的。
缺点是它是一个商业产品,有一点学习曲线。此外,根据您的要求,Telerik 控件可能有点重。
我没有使用具有此级别功能的其他第三方库的经验,因此可能还有其他解决方案。
The most straightforward way to do this is to use a 3rd party library such as Telerik's ASP.NET AJAX library (commonly referred to as Rad Controls).
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/templates/defaultcs.aspx
I have had good luck with Telerik. One nice thing about the RadComboBox (their full-featured drop down list for ASP.NET) is that it allows you to override the rendering of every item in the list if you wish. By overriding the rendering of each item, you may put any kind of HTML into the drop down list (including images, tables, etc). So it is pretty powerful.
The down-side is that it is a commercial product and there is a bit of a learning curve. Also, Telerik controls can be a little heavy depending upon your requirements.
I don't have experience with other 3rd party libraries with this level of functionality, so there may be other solutions out there.