简体   繁体   English

ASP.NET网站的选项卡

[英]Tabs for a ASP.NET website

I would like to add tabs for my website and I understand I can use the tab control in the AJAX toolkit or I can choose to go with JQuery UI tabs. 我想为我的网站添加标签,我知道我可以使用AJAX工具包中的标签控件,或者我可以选择使用JQuery UI标签。 Each tab would need to load a separate asp.net page and I need to customize the tabs to look slick. 每个选项卡都需要加载一个单独的asp.net页面,我需要自定义选项卡以使其看起来光滑。

Any thoughts on what approach I can use? 关于我可以使用什么方法的任何想法?

there are 1001 ways to accomplish the behavior ... 1001种方法来完成这种行为 ......

you can even go with jQuery Tools and load each tab asynchronously from each page 你甚至可以使用jQuery Tools并从每个页面异步加载每个选项卡

can you be more detailed on what's the exact problem, as your question is kinda vague ... 你可以更详细地说明确切的问题,因为你的问题有点模糊......

JQuery tabs are designed to make pure client-side and AJAX tabbing as easy as possible. JQuery选项卡旨在使纯客户端和AJAX选项卡尽可能简单。 Your requirements are to have each tab go to a distinct web page. 您的要求是让每个选项卡都转到不同的网页。 In this case this might be the wrong approach. 在这种情况下,这可能是错误的方法。

Since each tab is going to be a different ASP.NET page you'll want something that's easy to configure on the server side so that 1) the tab control can easily be reused; 由于每个选项卡都将是一个不同的ASP.NET页面,因此您需要在服务器端轻松配置的内容,以便1)可以轻松地重用选项卡控件; 2) it's easy to specify which tab is "opened" from the server-side. 2)很容易指定从服务器端“打开”哪个选项卡。 I suspect ASP.NET AJAX's version will be easier on both counts. 我怀疑ASP.NET AJAX的版本在这两方面都会更容易。

Then again, my own experience has been with RadControls' RadTabStrip . 然后,我自己的经验是RadControls的RadTabStrip If you have a few bucks to spend, you can get a great set of reusable widgets from these guys that are very customizable. 如果你有几块钱可以花,你可以从这些可以自定义的人那里获得一套很好的可重复使用的小部件。

You can see a demo of the AjaxControlToolkit tabs offering here: 您可以在此处查看AjaxControlToolkit选项卡的演示:

If you look at the bottom you will see a section on themeing it. 如果你看一下底部,你会看到一个主题部分。 You can fully change the layout to suit your needs. 您可以完全更改布局以满足您的需求。

As for loading separate pages into each tab you need to clarify what you mean as there are several options here: 至于将单独的页面加载到每个选项卡中,您需要澄清您的意思,因为这里有几个选项:

  1. Put an iframe inside the tab which points to an external file 在选项卡中放置一个指向外部文件的iframe
  2. Pull in the contents of another file using ajax and inject it into the tab (not directly supported by the ajaxcontroltoolkit tabs) 使用ajax拉入另一个文件的内容并将其注入选项卡(ajaxcontroltoolkit选项卡不直接支持)
  3. User Controls. 用户控制。 You can create separate user controls to represent pages. 您可以创建单独的用户控件来表示页面。 This will allow you to compartmentalise up functionality and develop it separate from the main clutter of the page. 这将允许您划分功能并将其与页面的主要混乱区分开来。

If having search engines being able to see and index the contents of these tabs then you should also indicate this as not all of the solutions above are Google friendly (or accessible for blind users). 如果让搜索引擎能够查看并索引这些标签的内容,那么您还应该指出这一点,因为并非上述所有解决方案都是Google友好的(或盲人用户可访问)。

My question is given that the content of my tab pages are separate aspx pages, should I go with JQuery tabs or tabs control from the ajax toolkit 我的问题是我的标签页的内容是单独的aspx页面,我应该使用ajax工具包中的JQuery选项卡或标签控件

Given that, AjaxControltoolkit isn't really an option. 鉴于此,AjaxControltoolkit不是一个真正的选择。 AjaxControlToolkit tabs are controls, which means they need to live inside a server side form. AjaxControlToolkit选项卡是控件,这意味着它们需要存在于服务器端表单中。 Even if you could get them to load the contents of another ASPX page, the most likely result of that would be nested html forms, which isn't really supported. 即使你可以让他们加载另一个ASPX页面的内容,最可能的结果是嵌套的html表单,这是不真正支持的。

If you go the jQuery UI tabs route, you will most likely run into different issues: page redirects on postback . 如果你去jQuery UI标签路线,你很可能遇到不同的问题: 回页上的页面重定向 You could try to work around that problem using the jQuery Form (something along these lines ), but you might have a hard time working around controls that submit forms using the __doPostBack method. 您可以尝试使用jQuery Form解决这个问题(沿着这些问题 ),但是您可能很难解决使用__doPostBack方法提交表单的控件。 If your ASPX pages rely on postbacks, your best bet is probably to host an iframe for each tab and load your aspx pages that way. 如果您的ASPX页面依赖于回发,那么您最好的选择是为每个选项卡托管一个iframe并以这种方式加载您的aspx页面。 That will allow your pages to still function properly with postbacks. 这将使您的页面仍能正常运行回发。

ASP.NET MVC lands itself much better to the setup you're trying to achieve if that's at all an option. 如果完全可以选择的话,ASP.NET MVC会更好地适应你想要实现的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM