Question: I need to know how to pass arguments to a call to a JavaScript function made from an Html checkbox helper that is generated at run time.
This is my dynamic generation of checkbox controls:

```
@foreach (var app in ViewData["Applications"] as    List<RenderController.Models.Application>)
{
    <td>
        @*@Html.CheckBox(item.NetworkName + app.ProcessName, new { id=item.NetworkName + app.ProcessName, onclick = String.Format("callProcess('{0}', '{1}')",item.NetworkName,app.Name) })*@
        @Html.CheckBox(item.NetworkName + app.ProcessName, new Dictionary<string, object>
        { 
            {"id", String.Concat(item.NetworkName, app.ProcessName)},
            {"onclick", "callProcess.call(this)"}
        })
    </td>
}

```

And this is my JavaScript function:

```
<script type="text/javascript">
    function callProcess(Node, Process) {
        var url = "/RenderNodes/CallProcess";
        var checked = $('#'+Node + Process).is(':checked');
    }
</script>

```

The syntax `callProcess.call(this)` works (I've tested just placing an alert in the function) whereas the `String.Format()` approach in the commented `@Html.CheckBox()` generation does nothing. So if I use call(this), how do I pass the arguments `item.NetworkName` and `app.ProcessName`?

Answer: 
You can use `data-` attributes to add additional data to html elements and access then in the script, for example `@Html.CheckBox("..", new { data_networkname = item.NetworkName })`. However there is no point using `@Html.CheckBox()` in your case since you not binding to anything and your just generating a lot of unnecessary html including the associated hidden input. Nor is there any point using `{"id", String.Concat(item.NetworkName, app.ProcessName)}` since your just generating the same `id` attribute that is already added by the html helper anyway.

Instead you can just use

```
<input type"checkbox" class="checkbox" data-networkname="@item.NetworkName" data-processname="@app.ProcessName" />

```

then in the script

```
var url = '@Url.Action("CallProcess", "RenderNodes")'; // dont hard code!
$('.checkbox').click(function() {
    var checked = $(this).is(':checked');
    var node = $(this).data('networkname');
    var process = $(this).data('processname');
    ....
});

```
You're passing `app.Name` instead of `app.ProcessName` in your `String.Format` example. Otherwise, I see no reason why that code shouldn't work.