当我在按钮控件上添加Onclientclick时,CommandName不起作用

时间:2017-11-23 07:28:08

标签: jquery winforms

jquery的:

 function GetSelectedRow(lnk) {
        var row = lnk.parentNode.parentNode;
        var rowIndex = row.rowIndex - 1;
        alert("RowIndex: "+rowIndex);
        return false;
    }

asp.net

<asp:Button ID="EmailSendbtn" Text="Send E-Mail" runat="server" OnClientClick = "return GetSelectedRow(this)" UseSubmitBehavior="false" CommandName="SendEmail" CommandArgument='<%# Eval("Directory")+","+ Eval("FirstFile")+","+ Eval("FirstFileDateModified")%>'    />  

添加onClientClick后无法访问Commandname方法。当我删除它,它完美地工作。 该怎么办? 提前致谢

1 个答案:

答案 0 :(得分:0)

简单方法: -

&#13;
&#13;
function showMessage(msg) {
   alert(msg);
};
&#13;
<input type="button" value="click" onclick="showMessage('msgs');" />
&#13;
&#13;
&#13;