这里我只传递了从telerik到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();
%>
答案 0 :(得分:1)
不确定你的问题是什么,这是你想要实现的目标吗?
<a href="javascript:void(0);"
onclick="AddOdometer(<%: b.VehicleRepositoryId %>, <%: b.SecondParam %>)"
title="ADDTrip" id="A1">Add Distance</a>