简体   繁体   中英

How do I add a button and add event to it

I use this code to make a button in c#

var Unqualify = new Button { Text = "Unqualify", CssClass = "ActionButton", ID = "4" + lead.ID, 

OnClientClick = "javascript:ShowActionCheckList('" + lead.ID + "');", UseSubmitBehavior = false };

The show action function:

function ShowActionCheckList(id) {
    $("#divActionList_" + id).fadeIn('fast');
}

I read and found that this "UseSubmitBehavior = false" should fix the problem but it's not helping

Any ideas ?

您应该在OnClientClick函数的末尾添加return false

OnClientClick = "ShowActionCheckList('" + lead.ID + "'); return false";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM