JQuery tabcontrol:加载gridview
我有一个 JQuery/CSS tabcontrol,它当前处理 4 个选项卡,包含 gridviews。 我希望当您点击选项卡时加载网格视图。这减少了页面的加载时间,因为某些 gridview 的存储过程需要一些时间。 网格视图需要加载一次,不必在每次打开特定选项卡时更新它们。
JQuery:
$(document).ready(function()
{
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function()
{
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
});
现在我刚刚开始使用JQuery,所以我真的不知道如何处理这个...... 有人有想法吗?
I got a JQuery/CSS tabcontrol, which currently handle 4 tabs, containing gridviews.
I'd like the gridview to be loaded, when you hit the tabs. This reduces the loading time of the page, as some of the gridview's sprocs take some time.
The gridviews need to load once, they don't have to be updated each time you open the specific tab.
JQuery:
$(document).ready(function()
{
//When page loads...
$(".tab_content").hide(); //Hide all content
$("ul.tabs li:first").addClass("active").show(); //Activate first tab
$(".tab_content:first").show(); //Show first tab content
//On Click Event
$("ul.tabs li").click(function()
{
$("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".tab_content").hide(); //Hide all tab content
var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active ID content
return false;
});
});
Now I just started using JQuery, so I really don't know to handle this...
Anyone ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有类似的问题。我所做的是创建一个按钮来加载 gridview,然后在 jquery 选项卡的选择事件中单击这些按钮。像这样的事情:
I had a similar issue. What i did was create a button to load the gridview, and in the select event for the jquery tabs I click those buttons. Something like this:
如果您想在服务器上执行所有操作,则需要一个更新面板,并使用 __doPostBack 强制回发,以便服务器可以处理请求...您也可以使用 $.ajax 来执行此操作。否则
,所有操作都在客户端上完成,将数据从 Web 服务流式传输到客户端,并在客户端上构建表。
HTH。
If you want to do everything on the server, you need an update panel, and force a postback using __doPostBack so that the server can process the request... You may also be able to use $.ajax to do this as well...
Otherwise, do it all on the client, stream the data to the client from a web service, and build the table on the client.
HTH.