I have a tab strip containing many tabs. when i make some changes in tab 2, a confirm msg pops up asking if i want to continue without saving and if i say yes, i need to reset the value of the modified field in tab 2 to its original. Please help me do this.
please find below my sample code
Html.Telerik().TabStrip().Name("TabStripEmployeeDetail")
.Items(items =>
{
items.Add()
.Text("tab1").HtmlAttributes(new { onclick = "return warnOfChanges()" })
.LoadContentFrom(......);
items.Add().HtmlAttributes(new { onclick = "return warnOfChanges()" })
.Text("tab2")
.LoadContentFrom(......);
items.Add()
.Text("tab3")
.LoadContentFrom(.......);
items.Add()
.Text("tab4")
.LoadContentFrom(....);
items.Add()
I have a javascript function
function warnOfChanges() {
if(documentmodified) {
return confirm('Changes have been made on this tab. Continue without saving?');
}
return true;
};
and i am calling this onclick of the tab. please help here
First of all I suggest you to use the select event of the TabStrip instead of attaching the same handler on the tab items.
To actually reset these settings (since you are loading them with Ajax) the easiest way would be to refresh the content of the TabFrom the server. To refresh a particular tab you could use the reload method of the Client API.
Check the documentation for examples how to use the reload method.