0

在单击 CheckBox 后,我在 MVC3 中使用 RouteUrl for window.location.href 和 JavaScript,我有多个复选框,我在 selectedValues 中获取所有选中的复选框值,然后将 RouteUrl 作为参数传递,但它给出错误...

<script type="text/javascript" language="javascript">
//Get value of selected items
function GetSelectedValue() {

    var selectedValues = [];

    $("[id*=CheckBoxList1] input:checked").each(function () {
        selectedValues.push($(this).val());
    });

    var s = sele.tos();

    if (selectedValues.length > 0) 
    {
        // alert("Checkbox selected value(s): " + selectedValues);

     window.location.href = 'Url.RouteUrl("MultipleManufacturer", new { manufacturerId = selectedValues })';

    } 
    else
    {
        alert("No item has been selected.");
    }
}

4

1 回答 1

0

我得到了答案...

function GetSelectedValue() {

    var selectedValues = [];

    $("[id*=CheckBoxList1] input:checked").each(function () {
        selectedValues.push($(this).val());
    });


    if (selectedValues.length > 0) {

        var url = '@Url.RouteUrl("MultipleManufacturer", new { manufacturerId = "_documentId_"})';
        var finalUrl = url.replace('_documentId_', selectedValues);

        window.location.href = finalUrl;

    } 
于 2013-04-16T05:26:49.273 回答