2013-10-17 90 views
0

在我的MVC应用程序林使用jQuery UI选项卡(jQuery的UI-1.9.0),并设置一个选项卡使用脚本选择以下如何让选择的选项卡jQuery UI的标签提交

<script type="text/javascript"> 
$(document).ready(function() { 
    $("#tabs").tabs({ selected: @Convert.ToInt32(Model.SearchModel.SearchType) }) 
}); 

<div id="tabs"> 
<ul> 
    <li><a href="#articlesearchtab">Article</a></li> 
    <li><a href="#othersearchtab">Other</a></li> 
</ul> 

<div id="articlesearchtab"> 
    //content 
</div> 

<div id="othersearchtab"> 
    //content 
</div> 

用户可以进入任一选项卡并更新内容。我需要在表单提交中获取选定选项卡的内容。我怎样才能知道用户选择的标签?

+0

其jquery-ui-1.9.0 – rumi

回答

0

In jQuery UI 1.9, the selected option is deprecated:

已弃用选择的选项;已更名为活动

(#7135)所选选项已重命名为活动状态,以便与jQuery UI中的其他插件保持一致性 。您应该将所选选项的所有用途替换为活动选项。

所选选项将在1.10中删除。

Here is the new way to get the current tab:

布尔:主动设置为false,将折叠所有面板。这要求可折叠选项为真。 整数:处于活动状态(打开)的面板的从零开始的索引。负值选择从最后一个面板向后的面板。

代码示例:

初始化的标签,用指定的活动选项:

$(".selector").tabs({ active: 1 }); 

获取或设置活动选项,初始化后:

// getter 
var active = $(".selector").tabs("option", "active"); 

// setter 
$(".selector").tabs("option", "active", 1); 
0

简单地说,在JavaScript提交表单的位置使用Code调用JavaScript中的相同选项卡。

<script type="text/javascript" language="javascript"> 
    function OpenMoreDetails(id) { 
     document.getElementById(id).style.display = 'block'; 
     return false; 
    } 
</script> 

protected void btnAttachDocument_Click(object sender, EventArgs e) 
{ 

    //your code  
    ScriptManager.RegisterStartupScript(this, GetType(), "attach", "OpenSearchOption('yourtabid',this);", true); 
} 
+0

嗨学习者,发生什么事了? – SANDEEP

相关问题