
<script type="text/javascript">
    $(function () {
        $("a.postLink").click(function (e) {
            e.preventDefault();
            $.post($(this).attr("href"), function (data) {
                if (data != null && data.length.toString.length > 0) {

                    var form = document.createElement("form");

                    form.setAttribute('method', "post");
                    form.setAttribute('action', data.toString().split("||")[1]);
                    var id = document.createElement("input");
                    id.type = "text";
                    id.name = "id";
                    id.value = data.toString().split("||")[0];
                    form.appendChild(id);
                    document.body.appendChild(form);
                    form.submit();
                }
                else
                    alert('Document could not be downloaded');
                // got the result in data variable. do whatever you want now
                //may be reload the page
            });
        });
    });    
</script>


@Html.ActionLink("Print", "DoPrint", new { docId= 1 }, new { @class = "postLink k-button" });


@(Html.Kendo().Grid<Captira.Data.Master.ViewPowerSendingRequest>()
          .Name("pendingPowersGrid")
        //.HtmlAttributes(new {@style = "width:100%; min-width:1000px;"})
                    .Columns(columns =>
              {
                  columns.Bound(p => p.docId).ClientTemplate(@Html.ActionLink("Print", "DoPrint", new { docId = "#=docId#" }, new { @class = "postLink k-button" }).ToHtmlString());

              })
                    .DataSource(dataSource => dataSource // Configure the grid data source
                                        .Ajax()  //Specify that ajax binding is used
                                                .Read(read => read.Action("GetDocsJson", "EDocs")) // Set the action method which will return the data in JSON format
                                        .Model(model => model.Id(p => p.PowerId))
                    )
                  .Pageable()
                  .Sortable()
)
