簡體   English   中英

如何在ASP的Kendo UI網格字段中編寫單擊鏈接的單擊功能

[英]How to write the click Function for Link button in kendo UI Grid fields in asp

我是初學者實際上我試圖搜索Google關於我的要求,但是我什么都沒得到。 我的頁面像一個Kendo網格一樣,該網格具有三列和“編輯”和“刪除”按鈕,第一列像“鏈接”按鈕,在我的網格中有十行,我的要求是,如果我單擊鏈接按鈕,則意味着單擊“行詳細信息”以打開新網頁,我的代碼喜歡,

 editable  : {mode : "inline"   },
 navigable: true,
 columns:  [  {
           field: "SystemName",
           title: "System Name",
           width:"130px",
           template: '<a href="\\#" class="k-Linkbutton link">#= SystemName #</a>' },
             {
                        field: "SystemIP",
                        title: "System IP",
                          width:"100px" },
                    {
                        field: "SystemType",
                        title: "Type",
                        width:"80px",
                        editor: function (container, options) {
                        $("<input />")
                        .attr("data-bind", "value:SystemType")
                          .appendTo(container)
                           .kendoDropDownList({
                         dataSource: [ { text: "--Select--" ,value: "0"},{ text: "PC" ,value: "1"},{ text: "LAPTOP" ,value: "2" }],
                    dataTextField: "text",
                    dataValueField: "text"
                }); }},
                    {
                        field: "OSKey",
                        title: "OS Key",
                        width:"200px"
                    },

          { 
                 command: ["edit","destroy"], 
                       title: "&nbsp;", 
                        width: "190px" 
                    }       
                ]

如何打開NEw網頁,我知道window.open(“ aaa.aspx”)這是一種方法,但是我不知道如何實現,謝謝!!!

  template: '<a href="\\#" onclick="New()" class="k-Linkbutton link">#= SystemName #</a>' }

Function New()
{
Window.open("Welcom.aspx")
}

kendo網格綁定后,您可以將click事件綁定到如下所示的鏈接按鈕,並在此處查看實際操作
在下面的演示中,觀察$('ak-Linkbutton.link').on("click", function () {});

<!DOCTYPE html>
<html>
<head>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
    <title>demo</title>
</head>
<body>
    <table id="kendo-grid">
        <tr><td><a href="#" class="k-Linkbutton link">First</a>  </td><td>One</td><td> 1 st</td></tr>
        <tr><td><a href="#" class="k-Linkbutton link">Second</a>  </td><td>Two</td><td>2 nd</td></tr>
    </table>
    <script type="text/javascript">
        /* global variables and function definitions here */
        $(function () {
            //Here you should keep your Kendo grid bind script and other start-up scripts

            //below click event attach should be at the end
            $('a.k-Linkbutton.link').on("click", function () {
                var $rowContent = $.makeArray($(this).closest('tr').children().map(function () { return '<div />' + $(this).html() + "</div>"; })).join(""),
                newWindow = window.open("https" === document.location.protocol ? "javascript:false" : "about:blank", "MsgWindow", "width=500, height=300", true);

                newWindow.document.write($rowContent);

            });

        });
    </script>
</body>
</html>

調用JavaScript函數而不發布

                            <asp:GridView runat="server" ID="grdAdvTravel">
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <a href="javascript:EditAdvanceTravelFee( '<%#Eval("fee_catg_srno")%>','<%#Eval("trvl_amt")%>','<%#Eval("pay_date")%>','<%#Eval("fee_name")%>','<%#Eval("status")%>' )" class="btn btn-primary">EDIT</a>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM