2013-10-17 78 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

相關問題