0

ここでは、テレリックから JavaScript 関数に単一のパラメーターのみを渡します。別のパラメーターも渡す必要があります

 <a href="javascript:void(0);" onclick="AddOdometer(<%: b.VehicleRepositoryId %>)"
            title="ADDTrip" id="A1">Add Distance</a>

参照用のコード全体

 <% Html.Telerik().Grid(Model.VehicleList)
                                .Name("VehiclesRepositoryGrid")
                                    .Columns(colums =>
                                    {
                                        colums.Bound(b => b.TruckNumber).Title("Vehicle Number")
                                            .FooterTemplate(() =>
                       {%>
        Total:
        <%})
                        .Width(100);
                                        colums.Bound(b => b.Month);
                                        colums.Bound(b => b.FuelType).Title("Fuel Type");
                                        colums.Bound(b => b.TotalDistance).Title("Distance")
                        .FooterTemplate(() =>
                        {%>
        <%= Model.VehicleList.Sum(v=>v.TotalDistance)%>
        <%})
                        .Width(100);
                                        colums.Bound(b => b.TotalFuel).Title("Fuel")
                                             .FooterTemplate(() =>
                       {%>
        <%= Model.VehicleList.Sum(v => v.TotalFuel)%>
        <%})
                        .Width(100);
                                        colums.Bound(b => b.Mileage);

                                        colums.Template(b =>
                                          {
        %>
        <% if (b.TotalDistance == 0)
           {%>
        <a href="javascript:void(0);" onclick="AddOdometer(<%: b.VehicleRepositoryId %>)"
            title="ADDTrip" id="A1">Add Distance</a>
        <%}
           else
           { %>
        <a href="javascript:void(0);" onclick="EditOdometer(<%: b.VehicleRepositoryId %>)"
            title="Edit">
            <img src="<%= ResolveUrl("~/Content/Images/Edit.gif")%>" alt="Edit" title="Edit"
                class="vaM" /></a> | <a href="javascript:void(0);" onclick="DeleteOdometer(<%: b.VehicleRepositoryId %>)"
                    id="DeleteVehicle">
                    <img src="<%= ResolveUrl("~/Content/Images/Delete.gif")%>" alt="Delete" title="Delete"
                        class="vaM" /></a>
        <% } %>
        <%
                                          }).Title("Actions")
            .Width(100).HtmlAttributes(new { @class = "taC" });
                                    })
                                     .Groupable(settings => settings.Groups(groups =>
                                     {
                                         groups.Add(o => o.TruckNumber);
                                         if (ViewData["Grouping"] != null)
                                         {
                                             groups.Add(o => o.Month);
                                         }
                                     }))
                                    .Scrollable(scrolling => scrolling.Enabled(false))
                                    .Sortable(sorting => sorting.Enabled(true))
                                    .Pageable(paging => paging.Enabled(true))
                                    .Filterable(filtering => filtering.Enabled(true))
                                    .Footer(true)
                                    .Render();
        %>
4

1 に答える 1

1

あなたの質問が何であるかわからない、これはあなたが達成したいことですか?

 <a href="javascript:void(0);" 
    onclick="AddOdometer(<%: b.VehicleRepositoryId %>, <%: b.SecondParam %>)"
    title="ADDTrip" id="A1">Add Distance</a>
于 2012-04-21T05:38:14.203 に答える