// this is my kendo strip code......
@(Html.Kendo().TabStrip()
.Name("TabStripPatientHome")
.Items(tabStrip =>
{
tabStrip.Add()
.Text("Patient Home")
.Content(@<text>
<table >
<tr>
<td>
Last Order/Consult
<br />
@LastOrderConsultData()
</td>
</tr>
</table>
</text>);
tabStrip.Add()
.Text("History")
.Content(@<text>
<p style="font-size: large; color: Navy;">
Order/Consult History
</p>
@RenderOrderHistory()
<br />
<p style="font-size: large; color: Navy;">
Consult Pre-Purchase History
</p>
@RenderTeleconsultHistory()
</text>);
}
})
// 定义剑道事件
.SelectedIndex(0)
.Events(events => events
// triggering select event in Kendo UI TabStrip. .Select("onSelectTab")
.ContentLoad("onLoadTab"))
)
// 使用 ajax 调用触发选择和内容加载事件.....
function onSelectTab(eventItem) {
debugger;
setTimeout("saveTabIndexSession();", 1000);
}
function onLoadTab(eventItem) {
debugger;
setSelectedTabIndex();
}
function setSelectedTabIndex() {
debugger;
var tabStrip = $("#TabStripPatientHome").data("tTabStrip");
var tabIndex = getPatientTabIndex();
//alert(tabIndex);
tabStrip.select($(".t-item", tabStrip.element)[tabIndex]);
}
function getPatientTabIndex() {
debugger;
var returnVal = 0;
$.ajax({
url: '@Url.Action("GetTabIndexFromSession", "Operations")',
type: 'POST',
success: function (data) {
returnVal = parseInt(data);
},
async: false,
error: function (xhr) {
alert("Something went wrong while checking Order Details, please try again");
}
});
return returnVal;
}
function saveTabIndexSession() {
debugger;
var tabStrip = $("#TabStripPatientHome").data("tTabStrip");
var tabIndex = tabStrip.getSelectedTabIndex();
$.ajax({
url: '@Url.Action("SaveTabIndexSession", "Operations")',
type: 'POST',
data: { selectedTabIndex: tabIndex },
success: function (data) {
},
async: false,
error: function (xhr) {
alert("Something went wrong while checking Order Details, please try again");
}
});
//return _IsRXProductOrder;
}
// when i am clicking on another kendotab it append the url like #TabStripPatientHome-2
// http://operations.mdalignelocal.com/Operations/PatientHome?Patientid=837545#TabStripPatientHome-2