1. loading the existing Tabs
@helper RenderPCGTab(List<PCGTabModel> PCGs)
{
<a id="add-button">Add new PCG</a>
<div style="width:100%; height:auto;">
@(Html.Kendo().TabStrip()
.Name("PCGTabStrip").HtmlAttributes(new { style = "width:100%;" })
.Items(items =>
{
var index = 0;
foreach (PCGTabModel PCG in PCGs)
{
items.Add()
.Text("PCG <button id='btn'" + index + " data-type='remove' class='k-button k-button-icon' onclick='deleteMe(this)'><span class='k-icon k-i-close'></span></button>")
.Encoded(false)
.Content(@<text>@(Html.Partial("_PCGForm", PCG, new ViewDataDictionary { TemplateInfo = new TemplateInfo { HtmlFieldPrefix = "PCG" } }))</text>);
index++;
}
}))
</div>
}
2. </table>
<tr>
<td colspan="4">
@RenderPCGTab(Model.PCGTab)
</td>
</tr>
</table>
3. Script - to add dynamicic tabs
$('#add-button').kendoButton({
click: function () {
var tabstrip = $('#PCGTabStrip').kendoTabStrip();
validateCount = tabstrip.length;
var index = validateCount;
tabstrip.append([{
text: '<a>PCG <button id="btn' + index + '" data-type="remove" class="k-button k-button-icon deleteAll" onclick="deleteMe(this)"><span class="k-icon k-i-close"></span></button></a>',
encoded: false,
contentUrl: "@Url.Content("~/Home/_PCGTab?tabId=")" + index + ""
}]);
}
});
4. Partial view action method
public ActionResult _PCGTab(int tabId)
{
PCGTabModel model = model = new PCGTabModel() { PCGTabId = tabId, IsWhollyEntity = null };
return PartialView("_PCGForm", model);
}
5. Problem am facing
1.When i add a new tab and click on the existing tab , in the existing tab the content is getting duplicated i,e the whole content is getting duplicaated
2.If am not adding any new tab, if i click on any existing tab i dont have issue
@helper RenderPCGTab(List<PCGTabModel> PCGs)
{
<a id="add-button">Add new PCG</a>
<div style="width:100%; height:auto;">
@(Html.Kendo().TabStrip()
.Name("PCGTabStrip").HtmlAttributes(new { style = "width:100%;" })
.Items(items =>
{
var index = 0;
foreach (PCGTabModel PCG in PCGs)
{
items.Add()
.Text("PCG <button id='btn'" + index + " data-type='remove' class='k-button k-button-icon' onclick='deleteMe(this)'><span class='k-icon k-i-close'></span></button>")
.Encoded(false)
.Content(@<text>@(Html.Partial("_PCGForm", PCG, new ViewDataDictionary { TemplateInfo = new TemplateInfo { HtmlFieldPrefix = "PCG" } }))</text>);
index++;
}
}))
</div>
}
2. </table>
<tr>
<td colspan="4">
@RenderPCGTab(Model.PCGTab)
</td>
</tr>
</table>
3. Script - to add dynamicic tabs
$('#add-button').kendoButton({
click: function () {
var tabstrip = $('#PCGTabStrip').kendoTabStrip();
validateCount = tabstrip.length;
var index = validateCount;
tabstrip.append([{
text: '<a>PCG <button id="btn' + index + '" data-type="remove" class="k-button k-button-icon deleteAll" onclick="deleteMe(this)"><span class="k-icon k-i-close"></span></button></a>',
encoded: false,
contentUrl: "@Url.Content("~/Home/_PCGTab?tabId=")" + index + ""
}]);
}
});
4. Partial view action method
public ActionResult _PCGTab(int tabId)
{
PCGTabModel model = model = new PCGTabModel() { PCGTabId = tabId, IsWhollyEntity = null };
return PartialView("_PCGForm", model);
}
5. Problem am facing
1.When i add a new tab and click on the existing tab , in the existing tab the content is getting duplicated i,e the whole content is getting duplicaated
2.If am not adding any new tab, if i click on any existing tab i dont have issue