I have a tabstrip that loads its content from partial views, and this works well provided the routeValues never change. For example:
@(Html.Kendo().TabStrip()
.Name("MyTabStrip")
.Items(i =>
{
i.Add().Text("First Tab").LoadContentFrom("FirstAction", "MyController", new { id = ViewData["id"] });
i.Add().Text("Second Tab").LoadContentFrom("SecondAction", "MyController", new { id = ViewData["id"] });
})
)
This will hit FirstAction and SecondAction when the tabs are selected, and carry the id along from ViewData, this is fine.
...but if "id" is a more dynamic bit of data, that needs to change on the page, this approach is no longer valid.
The TabStrips do not have any Data function, akin to what can be found in the Read attribute in a regular DataSource, which would have been nice, and there is nothing too helpful in the Select event of the TabStrip. I have tried editing the _contentUrls list inside the TabStrip element, but this does not seem to work, either; it seems this is populated when the element is created, but not actually used.
...so how can this be done? Is there any way to update the content urls of an existing tab?
Hi Tlerik Team,
I'm trying to disable the animation for the Kendo MVC TabStrip and I did like
@{ Html.Kendo().TabStrip()
.Name("tabxyz")
.Events(events => events.Select("onSelect"))
.Animation(animation =>
{
animation.Enable(false);
})
And its working as expected; But when I change the tab using the java script code, the animation is enabled again!!!!
Here is the code that I used.
var tabstrip = $("#tabxyz").kendoTabStrip().data("kendoTabStrip");
var myTab = tabstrip.tabGroup.children("li").eq(selectedTab);
tabstrip.select(myTab);
Please let me know what i'm doing wrong!!
Thanks in advance.
Mahendra.
Hello,
We have a requirement to navigate between tabs using back and next buttons; an additional requirement is that if a tab contains a child tabstrip the next button should begin navigating through the child tabs before continuing on with the parent tabs.
The basic structure is as follows:
Parent tabstrip contains tabs 1, 2, 3. Tab 2 contains a child tabstrip with tabs 4, and 5.
Beginning on tab 1, clicking the next button should select tab 2. Once on tab 2 clicking next should select tab 4. Once on tab 4 clicking next should select tab 5. Once on tab 5 clicking next should select tab 3. Clicking back should do the reverse.
I have no problem going forward from 1 -> 2 -> 4 -> 5; I have no problem going back within a single tabstrip 5 -> 4 or 2 -> 1, however, going from child up to parent , 4 -> 2, doesn't work; it seems tab 2 never has gets selected or activated.
Any ideas on how to accomplish this? I've included a simplified prototype of our initial approach.
Thanks for any advice.
Hi,
Trying to build a multicolumn form within a tabstrip using div and bootstrap grid tags. Even after reading article about Bootstrap and Kendo, (http://docs.telerik.com/kendo-ui/third-party/using-kendo-with-twitter-bootstrap#nesting-kendo-ui-widgets-and-bootstrap-grid-layout), the layout seems not to work as expected like in:
01.
<
div
class
=
"row"
>
02.
<
div
class
=
"col-sm-6 col-md-6"
>
03.
<
div
class
=
"form-group"
>
04.
Name
05.
@(Html.Kendo().TextBoxFor(m => m.Nome).HtmlAttributes(new { @class = "k-textbox" }))
06.
</
div
>
07.
<
div
class
=
"form-group"
>
08.
Last Change
09.
@(Html.Kendo().TextBoxFor(m => m.ModifiedOn).HtmlAttributes(new { @class = "k-textbox" }))
10.
</
div
>
11.
</
div
>
12.
<
div
class
=
"col-sm-6 col-md-6"
>
13.
<
div
class
=
"form-group"
>
14.
Status
15.
@(Html.Kendo().TextBoxFor(m => m.Status).HtmlAttributes(new { @class = "k-textbox" }))
16.
</
div
>
17.
<
div
class
=
"form-group"
>
18.
Workflow
19.
@(Html.Kendo().TextBoxFor(m => m.WorkflowStatus).HtmlAttributes(new { @class = "k-textbox" }))
20.
</
div
>
21.
</
div
>
22.
</
div
>
The expected result would be a form with two columns and fields (2x) on both sides. The code is in a partial view and it is invoked on the tabstrip as follows:
01.
@
using
(Html.BeginForm())
02.
{
03.
@Html.AntiForgeryToken()
04.
05.
@(Html.Kendo().TabStrip()
06.
.Name(
"customerRecord"
)
07.
.Items(tab =>
08.
{
09.
tab.Add().Text(
"Personal Data"
)
10.
.Selected(
true
)
11.
.Content(m => Html.Partial(
"_PersonalData"
, m));
12.
})
13.
)
14.
}
Is this the way to have it done or not?
Regards,
Marcello
Hello guys, i am trying to load a partial view in my tab-strip. each tab strip has a place-holder, where the partial view. will be displayed. One first load, the partial view displays that data. However, when i click the subsequent tabs, the tab-strip does not reload with the new data. i have added a tab re-load logic but, to no avail unfortunately.
Here is my Index.cshtml
01.
<div class=
"demo-section k-content"
>
02.
@(Html.Kendo().TabStrip()
03.
.Name(
"tabstrip"
)
04.
.Events(events => events
05.
.Select(
"onSelect"
)
06.
)
07.
.Animation(animation =>
08.
animation.Open(effect =>
09.
effect.Fade(FadeDirection.In)))
10.
.Items(tabstrip =>
11.
{
12.
tabstrip.Add().Text(
"James Bond"
)
13.
.Selected(
true
)
14.
.Content(@<text>
15.
<div id=
"partialPlaceHolder"
style=
"display:none;"
>
16.
17.
</div>
18.
</text>);
19.
20.
tabstrip.Add().Text(
"Earl Klugh"
)
21.
.Content(@<text>
22.
<div id=
"partialPlaceHolder"
style=
"display:none;"
>
23.
24.
</div>
25.
</text>);
26.
27.
tabstrip.Add().Text(
"Paul Play"
)
28.
.Content(@<text>
29.
<div id=
"partialPlaceHolder"
style=
"display:none;"
>
30.
31.
</div>
32.
</text>);
33.
34.
tabstrip.Add().Text(
"Chinonso M"
)
35.
.Content(@<text>
36.
<div id=
"partialPlaceHolder"
style=
"display:none;"
>
37.
38.
</div>
39.
</text>);
40.
})
41.
)
42.
</div>
43.
44.
<script type=
"text/javascript"
>
45.
46.
$(document).ready(
function
() {
47.
$(
"#tabstrip"
).kendoTabStrip({
48.
animation: {
49.
open: {
50.
effects:
"fadeIn"
51.
}
52.
}
53.
});
54.
55.
$.get(
'/Parent/MyAction'
, { id: 1 },
function
(data) {
56.
57.
$(
'#partialPlaceHolder'
).html(data);
58.
/* little fade in effect */
59.
$(
'#partialPlaceHolder'
).fadeIn(
'fast'
);
60.
})
61.
});
62.
63.
function
onSelect(e) {
64.
// alert($(e.item).find("> .k-link").text());
65.
//$(e.contentElement).html("");
66.
var
tabName = $(e.item).find(
"> .k-link"
).text();
67.
var
id = 0;
68.
69.
if
(tabName ==
"James Bond"
){ id = 1; }
70.
71.
else
if
(tabName ==
"Earl Klugh"
){ id = 2; }
72.
73.
else
if
(tabName ==
"Paul Play"
) { id = 3; }
74.
75.
else
if
(tabName ==
"Chinonso M"
){ id = 4; }
76.
77.
$.get(
'/Parent/MyAction'
, { id: id },
function
(data) {
78.
79.
$(
'#partialPlaceHolder'
).html(data);
80.
/* little fade in effect */
81.
$(
'#partialPlaceHolder'
).fadeIn(
'fast'
);
82.
})
83.
84.
//var ts = $("#tabstrip").data().kendoTabStrip;
85.
//var item = ts.items()[1];
86.
//ts.reload(item);
87.
88.
var
ts = $(
"#tabstrip"
).data().kendoTabStrip;
89.
ts.tabGroup.on(
'click'
,
'li'
,
function
(e) {
90.
ts.reload($(
this
));
91.
})
92.
}
93.
94.
</script>
Here is my ParentController.cs
01.
namespace
JustTestingWeb3.Controllers
02.
{
03.
public
class
ParentController : Controller
04.
{
05.
public
DbQuery db =
new
DbQuery();
06.
// GET: Parent
07.
public
ActionResult Index()
08.
{
09.
return
View();
10.
}
11.
12.
public
ActionResult MyAction(
int
id)
13.
{
14.
var result = db.GetChildren(id);
15.
return
PartialView(
"~/Views/Child/Detail.cshtml"
,result);
16.
}
17.
}
18.
}
Here is the picture, when if load the firs time and when i click on the next tab. Thanks for your help.
Hi there guys, its me again. I have a tab-strip that calls a details page for a Person,House, and Car tab. These tabs display the data just fine. On each detail page, i have an edit button, when i click the edit button, right now, when i click the edit button, i am re-directed to the edit page outside of the tab-strip which isn't what i want. How do i make it load up the edit page within the tab-strip and ultimately when i click save, how to i make re-load the details page again within the tab-strip.
Index.cshtml- from the InfoController
01.
<div class=
"demo-section k-content"
>
02.
@(Html.Kendo().TabStrip()
03.
.Name(
"tabstrip"
)
04.
.Animation(animation => animation.Open(effect => effect.Fade(FadeDirection.In)))
05.
.Items(tabstrip =>
06.
{
07.
tabstrip.Add().Text(
"Person"
)
08.
.Content(@<text> <div class=
"form-group"
> @Html.Action(
"Detail"
,
"Person"
,
new
{ id = 1 }) </div> </text>);
09.
10.
tabstrip.Add().Text(
"House"
)
11.
.Content(@<text> <div class=
"form-group"
> @Html.Action(
"Detail"
,
"House"
,
new
{ id = 1 }) </div> </text>);
12.
13.
tabstrip.Add().Text(
"Car"
)
14.
.Content(@<text> <div class=
"form-group"
> @Html.Action(
"Detail"
,
"Car"
,
new
{ id = 1 }) </div></text>);
15.
})
16.
)
17.
</div>
18.
19.
20.
21.
<script type=
"text/javascript"
>
22.
23.
$(document).ready(
function
() {
24.
$(
"#tabstrip"
).kendoTabStrip({
25.
animation: {
26.
open: {
27.
effects:
"fadeIn"
28.
}
29.
}
30.
});
31.
32.
</script>
Here is the InfoController.cs
01.
using
System;
02.
using
System.Collections.Generic;
03.
using
System.Linq;
04.
using
System.Web;
05.
using
System.Web.Mvc;
06.
07.
namespace
JustTestingWeb4.Controllers
08.
{
09.
public
class
InfoController : Controller
10.
{
11.
// GET: Info
12.
public
ActionResult Index()
13.
{
14.
return
View();
15.
}
16.
}
17.
}
Here is my Detail.cshtml - for the Person tab
01.
@model JustTestingWeb4.Models.Person
02.
03.
<
div
>
04.
<
h4
>Person</
h4
>
05.
<
hr
/>
06.
<
dl
class
=
"dl-horizontal"
>
07.
<
dt
>
08.
@Html.DisplayNameFor(model => model.FirstName)
09.
</
dt
>
10.
11.
<
dd
>
12.
@Html.DisplayFor(model => model.FirstName)
13.
</
dd
>
14.
15.
<
dt
>
16.
@Html.DisplayNameFor(model => model.LastName)
17.
</
dt
>
18.
19.
<
dd
>
20.
@Html.DisplayFor(model => model.LastName)
21.
</
dd
>
22.
23.
<
dt
>
24.
@Html.DisplayNameFor(model => model.Sex)
25.
</
dt
>
26.
27.
<
dd
>
28.
@Html.DisplayFor(model => model.Sex)
29.
</
dd
>
30.
31.
<
dt
>
32.
@Html.DisplayNameFor(model => model.Ssn)
33.
</
dt
>
34.
35.
<
dd
>
36.
@Html.DisplayFor(model => model.Ssn)
37.
</
dd
>
38.
39.
<
dt
>
40.
@Html.DisplayNameFor(model => model.PhoneNumber)
41.
</
dt
>
42.
43.
<
dd
>
44.
@Html.DisplayFor(model => model.PhoneNumber)
45.
</
dd
>
46.
47.
</
dl
>
48.
</
div
>
49.
<
p
>
50.
@Html.ActionLink("Edit", "Edit", "Person", new { id = 1 }, new { @class = "btn btn-primary", @style = "color:white; height:25px; width:35px; font-size: 0.99em; text-align:center" })
51.
</
p
>
And here is my Edit.cshtml for the - Person tab
01.
@model JustTestingWeb4.Models.Person
02.
03.
@using (Html.BeginForm())
04.
{
05.
@Html.AntiForgeryToken()
06.
07.
<
div
class
=
"form-horizontal"
>
08.
<
h4
>Person</
h4
>
09.
<
hr
/>
10.
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
11.
@Html.HiddenFor(model => model.PersonID)
12.
13.
<
div
class
=
"form-group"
>
14.
@Html.LabelFor(model => model.FirstName, htmlAttributes: new { @class = "control-label col-md-2" })
15.
<
div
class
=
"col-md-10"
>
16.
@Html.EditorFor(model => model.FirstName, new { htmlAttributes = new { @class = "form-control" } })
17.
@Html.ValidationMessageFor(model => model.FirstName, "", new { @class = "text-danger" })
18.
</
div
>
19.
</
div
>
20.
21.
<
div
class
=
"form-group"
>
22.
@Html.LabelFor(model => model.LastName, htmlAttributes: new { @class = "control-label col-md-2" })
23.
<
div
class
=
"col-md-10"
>
24.
@Html.EditorFor(model => model.LastName, new { htmlAttributes = new { @class = "form-control" } })
25.
@Html.ValidationMessageFor(model => model.LastName, "", new { @class = "text-danger" })
26.
</
div
>
27.
</
div
>
28.
29.
<
div
class
=
"form-group"
>
30.
@Html.LabelFor(model => model.Sex, htmlAttributes: new { @class = "control-label col-md-2" })
31.
<
div
class
=
"col-md-10"
>
32.
@Html.EditorFor(model => model.Sex, new { htmlAttributes = new { @class = "form-control" } })
33.
@Html.ValidationMessageFor(model => model.Sex, "", new { @class = "text-danger" })
34.
</
div
>
35.
</
div
>
36.
37.
<
div
class
=
"form-group"
>
38.
@Html.LabelFor(model => model.Ssn, htmlAttributes: new { @class = "control-label col-md-2" })
39.
<
div
class
=
"col-md-10"
>
40.
@Html.EditorFor(model => model.Ssn, new { htmlAttributes = new { @class = "form-control" } })
41.
@Html.ValidationMessageFor(model => model.Ssn, "", new { @class = "text-danger" })
42.
</
div
>
43.
</
div
>
44.
45.
<
div
class
=
"form-group"
>
46.
@Html.LabelFor(model => model.PhoneNumber, htmlAttributes: new { @class = "control-label col-md-2" })
47.
<
div
class
=
"col-md-10"
>
48.
@Html.EditorFor(model => model.PhoneNumber, new { htmlAttributes = new { @class = "form-control" } })
49.
@Html.ValidationMessageFor(model => model.PhoneNumber, "", new { @class = "text-danger" })
50.
</
div
>
51.
</
div
>
52.
53.
<
div
class
=
"form-group"
>
54.
<
div
class
=
"col-md-offset-2 col-md-10"
>
55.
<
input
type
=
"submit"
value
=
"Save"
class
=
"btn btn-default"
/>
56.
</
div
>
57.
</
div
>
58.
</
div
>
59.
}
And Finally here is my PersonController.cs
01.
using
JustTestingWeb4.Models;
02.
using
System.Web.Mvc;
03.
04.
namespace
JustTestingWeb4.Controllers
05.
{
06.
public
class
PersonController : Controller
07.
{
08.
public
DbQuery db =
new
DbQuery();
09.
10.
// GET: Person
11.
public
ActionResult Index()
12.
{
13.
return
View();
14.
}
15.
16.
public
PartialViewResult Detail(
int
id)
17.
{
18.
var result = db.GetPerson(id);
19.
return
PartialView(result);
20.
}
21.
22.
public
PartialViewResult Edit(
int
? id)
23.
{
24.
var result = db.GetPerson(id);
25.
return
PartialView(result);
26.
}
27.
28.
[HttpPost]
29.
public
PartialViewResult Edit([Bind(Include =
"PersonID,FirstName,LastName,Sex,Ssn,PhoneNumber"
)] Person person)
30.
{
31.
32.
33.
var result = db.UpdatePerson(person);
34.
35.
if
(result ==
true
)
36.
{
37.
var result1 = db.GetHouse(person.PersonID);
38.
return
PartialView(
"Detail"
, result1);
39.
}
40.
41.
42.
return
PartialView(person);
43.
}
44.
}
45.
}
I have attached images to help explain what i am seeing. Thanks for your help.
@(Html.Kendo().TabStrip()
.Name("tabstrip")
.Items(items =>
{
items.Add().Text("Unplanned").Content(@<
text
>
<
div
style
=
"margin-top:5px;margin-bottom:10px;margin-left:5px;"
>
<
textarea
id
=
"hs1"
name
=
"TextArea1"
rows
=
"4"
style
=
"width: 500px"
></
textarea
>
<
p
><
button
class
=
"k-button"
onclick
=
"saveHSOne();"
>Save</
button
></
p
>
</
div
>
</
text
>).Selected(true);
items.Add().Text("Planned").Content(@<
text
>
<
div
style
=
"margin-top:5px;margin-bottom:10px;margin-left:5px;"
>
<
textarea
id
=
"hs2"
name
=
"TextArea2"
rows
=
"4"
style
=
"width: 500px"
></
textarea
>
<
p
><
button
class
=
"k-button"
onclick
=
"saveHSTwo();"
>Save</
button
></
p
>
</
div
>
</
text
>);
items.Add().Text("Specialised").Content(@<
text
>
<
div
style
=
"margin-top:5px;margin-bottom:10px;margin-left:5px;"
>
<
textarea
id
=
"hs3"
name
=
"TextArea3"
rows
=
"4"
style
=
"width: 500px"
></
textarea
>
<
p
><
button
class
=
"k-button"
onclick
=
"saveHSThree();"
>Save</
button
></
p
>
</
div
>
</
text
>);
})
)
if
(currentDiv !=
'XXX'
) {
//Hide third tab
tabStrip.enable(tabStrip.tabGroup.children(
"li:eq(2)"
),
false
);
// disable tab 1
}
else
{
//show third tab
tabStrip.enable(tabStrip.tabGroup.children(
"li:eq(2)"
),
true
);
// disable tab 1
}
Hello,
In the last version of Kendo Tab the Scrolling button position is under the tab and not on the left and right side - why?
(see attached picture)
regards robert
I have tabstrip that is displaying a partial from a different controller/view area, but I cant get the post of the partial in the tabstrip to post back to the different controller
the View that the tab is in.
~/Areas/Secure/Views/Company/companyStaff.cshtml
display a view assocated to a different controller
tabstrip.Add().Text("Create Contact")
.Selected(false)
.Content(Html.Partial("~/Areas/Secure/Views/Contact/_ContactManagement.cshtml", new WebSite.Library.Models.Contact() , new ViewDataDictionary { { "Id", "0" } }).ToHtmlString());
How can I get the partial in the tab to post back to its own controller post method
Hello all,
This is more of a general question so I have opted to not include too much code with this question. I can provide more if it will help find a good solution.
I have an existing tab layout where the tabs link to asp:panels in the page that in turn render a TabStrip and a Grid below:
Html.RenderAction("GetTabStrip", new RouteValueDictionary { { ..., ...} });
Html.RenderPartial("Grid", Model["Grade"], new ViewDataDictionary(this.ViewData) { { "gridName", "..." }, { "dsReadAction", "..." } });
The tab layout basically serves as a TabStrip before we adopted the ASP.NET MVC flavour of Telerik. I have two such tabs in this layout that both render a TabStrip and Grid like above.
The first TabStrip works great - I am able to scroll horizontally (since there are a lot of tabs), and the content is shown as expected. But the second TabStrip does not scroll and the content does not show up. The k-tabstrip-items list elements seem to be different between the two TabStrips. Here is an li element from the first TabStrip:
<li class="k-item k-state-default" role="tab" aria-controls="tabstrip-2"><span class="k-loading k-complete"></span><a class="k-link" href="#tabstrip-2">New York - i really hope the scrolling works</a></li>
...and from the second TabStrip:
<li class="k-item k-state-default" ><a class="k-link" href="#tabstrip-2">New York - i really hope the scrolling works</a></li>
...so the second element is missing the following attributes and span tag:
role="tab" aria-controls="tabstrip-2"><span class="k-loading k-complete"></span>
I believe this could be the source of my issues, but I am unsure if this implementation will even work.
Thanks for reading - any feedback is appreciated.