网格中的Tabstrip不起作用

时间:2010-12-09 17:54:31

标签: telerik-mvc

我有一个网格,在详细信息视图中我使用的是标签,每个标签条都包含一个网格。问题是当点击选项卡时,没有任何反应。我正在使用2010.3.1110版本,并更新了所有的jquery。

这是我的site.Master

<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title><asp:ContentPlaceHolder ID="TitleContent" runat="server" /></title>
<link href="../../Content/Styles/Site.css?v=<%=DateTime.Now%>" rel="stylesheet" type="text/css" />
<script src="../../Scripts/2010.3.1110/jquery-1.4.3.min.js" type="text/javascript"></script>
<%=
            Html.Telerik().StyleSheetRegistrar()
                .DefaultGroup(group => group.DefaultPath("~/Content/2010.3.1110/")
                                            .Add("telerik.common.min.css")
                                            .Add("telerik.iks.min.css"))
%>
<script type="text/javascript">
    $(function () {
        $.fn.loadSelect = function (data) {
            return this.each(function () {
                this.options.length = 0;
                var select = this;
                $.each(data, function (index, itemData) {
                    var option = $('<option value="' + itemData.Value + '">' +
                                itemData.Text + '</option>');
                    $(select).append(option);
                });
            });
        };
    });

    function submitform() {
        document.myform.submit();
    }

    //do all this when the dom is loaded
    $(function () {
        //get all delete links (note the class i gave them in the html)
        $("a.delete-link").click(function () {
            //basically, if confirm is true (ok button is pressed), then  
            //the click event is permitted to continue, and the link will
            //be followed - however, if the cancel is pressed, the click event will be stopped here
            return confirm("Are you sure you want to delete this?");
        });
    });

    //do all this when the dom is loaded
    $(function () {
        //get all delete links (note the class i gave them in the html)
        $("a.save-before-link").click(function () {
            //basically, if confirm is true (ok button is pressed), then  
            //the click event is permitted to continue, and the link will
            //be followed - however, if the cancel is pressed, the click event will be stopped here
            return confirm("Did you save before clicking this link?");
        });
    });

</script>
<asp:ContentPlaceHolder ID="ScriptContent" runat="server" />

    

    <div id="wrap">

        <div id="main" class="clearfix">

            <div id="header">
                <asp:ContentPlaceHolder ID="HeaderContent" runat="server" />
            </div>

            <div id="sidebar">
                <asp:ContentPlaceHolder ID="SideBarContent" runat="server" />
            </div>

            <div id="content">
                <asp:ContentPlaceHolder ID="MainContent" runat="server" />
            </div>

        </div>

    </div>

        <div id="footer">
            <%
                Html.RenderPartial("SiteMasterFooter");%>
            <div style="clear: both;"><!-- --></div>
        </div>

        <div style="clear: both;"><!-- --></div>

        <%Html.Telerik().ScriptRegistrar().DefaultGroup(asset => asset.DefaultPath("~/Scripts/2010.3.1110")
                                         .Add("jquery-1.4.3.min.js")
                                         .Add("telerik.common.min.js")
                                         .Add("telerik.examples.min.js")
                                         .Add("jquery.validate.min.js")
                                         .Add("telerik.panelbar.min.js"))
                        .Render();%>
</body>

这是我的网格

Html.Telerik().Grid(Model)
        .Name("InvoiceDataGrid2")
        .Columns(columns =>
                     {
                         columns.Bound(s => s.Company.CompanyName)
                             .Title("Company Name");
                         columns.Bound(s => s.ManifestCount)
                             .Title("# of Manifests");
                         columns.Bound(s => s.ManifestTimeCount)
                             .Title("Manifest Time");
                         columns.Bound(s => s.FieldOfficeTimeCount)
                             .Title("Office Time");
                     })
        .DetailView(details => details.Template(e =>
                    {
                        %>
                        <%
                            Html.Telerik().TabStrip().Name("tabstrip_test_" + e.Company.CompanyName )
                            .Items(items =>
                                       {
                                           items.Add().Text("Blah 1").Content(() =>
                                                                                  {
                                                                                      %>
                                                                                      Blah blah blah
                                                                                      <%
                                                                                  });
                                           items.Add().Text("Blah 2").Content(() =>
                                                                                  {
                                                                                      %>
                                                                                      Blah blah blah
                                                                                      <%
                                                                                  });
                                       })
                                       .Render();
                        %>
                        <%
                    }))
        .Pageable(paging => paging.PageSize(5))
        .Sortable()
        .Render();
%>

我基本上复制了关于服务器详细信息绑定的演示,http://demos.telerik.com/aspnet-mvc/grid/detailsserverside但它只是不想工作。我已经确定我使用telerik.validate.min.js v1.7并添加了telerik.common.min.js但是再次,它无法正常工作。我需要帮助,请

1 个答案:

答案 0 :(得分:0)

好的,所以我这是一个愚蠢的问题。它无法工作的原因是因为我动态设置的名称,其中有一个空格。当我设置名称以具有项目的ID而不是名称时,它工作正常。