Telerik网格列命令,在点击时添加到URL#

时间:2015-11-16 08:59:51

标签: kendo-ui telerik kendo-grid kendo-asp.net-mvc telerik-grid

我在asp.net mvc项目中有这个telerik网格

<div class="actualGrid" id="actualGrid">
    @(Html.Kendo().Grid<AVNO_KPMG.Models.Bench>()    //Bench Grid
        .Name("grid")

    .Columns(columns =>
    {
        columns.Bound(p => p.name).Title("Bench").Filterable(ftb => ftb.Cell(cell => cell.Operator("startswith"))).Width(100);
        columns.Bound(p => p.freeSeats).Title("Free Seats").Width(200).Filterable(ftb => ftb.Cell(cell => cell.Operator("gte"))).HtmlAttributes(new { @class = "FreeSeats" })
            .ClientTemplate("<div class='barthingy'><div class='bars_text'><div class='seatsText'><span class=\"bookNotfull\"></span> <b>#=bookedSeats#</b> USED SEATS</div><div class='seatsText'><span class=\"bookfull\"></span> <b>#=freeSeats#</b> TOTAL OFSEATS</div></div><div id='bigbar'><div  class='bigbar'  style='width:100%; float:left; background-color:rgb(142, 188, 0);'><div  ' style='float:right; width:#=bookedSeats *100 / seatsCount#%; background-color:rgb(255, 99, 71); height:16px '  class='b_#=name#' id='temp-log'></div></div></div></div>");

        //buttons
        columns.Command(command => { command.Custom("checkBench1 ").Text(" AM ").Click("doCheckIn"); command.Custom("checkBench 2").Text(" PM ").Click("doCheckIn"); command.Custom("checkBench3").Text("All Day").Click("doCheckIn"); }).HtmlAttributes(new { @class = "comms#=freeSeats# freeAM#=seatsCount - (bookings_am + bookings_allday)# freePM#=seatsCount - (bookings_pm + bookings_allday)# freeALLDAY#=freeSeats#" }).Title("Check in").Width(200);
    })

    .Pageable()
    .Sortable()

    .Scrollable(scrolling => scrolling.Enabled(false))
            .Filterable(ftb => ftb.Mode(GridFilterMode.Row))
            //.HtmlAttributes(new { style = "height:530px;" })
            .Events(events => events.DataBound("onDataBound"))
    .DataSource(dataSource => dataSource
    .Ajax()
    //.Sort(sort => sort.Add("freeSeats").Ascending())
    .PageSize(10)
    .Events(events => events.Error("error_handler"))
    .Model(model => model.Id(p => p.id))
                    .Read(read => read.Action("GetBenches", "Deskcheckin"))
            )
    )
</div>

每当我按下命令列中的按钮时,即使我将按钮设置为什么也不做,网址前面会显示一个#。 我的网址就像是

http://www.aaaaaa.com/stuff

当我按下其中一个按钮时

http://www.aaaaaa.com/stuff#

如何禁用此功能?

1 个答案:

答案 0 :(得分:1)

请尝试使用以下代码段。对于自定义命令按钮网格生成相同的锚控件。默认设置为href =&#39;#&#39;我用href =&#39; javascript:void(0)&#39;。

替换了它
do {

   filesize1 = f.length();  // check file size
   Thread.sleep(5000);      // wait for 5 seconds
   filesize2 = f.length();  // check file size again

} while (length2 != length1); 

如果有任何疑虑,请告诉我。