Before using DataList to delete it, ask the user to confirm whether to delete the practice

xiaoxiao2021-03-06  14

Topic: Before using DataList to delete prompts, ask the user to confirm whether to delete the practice

Author: JPYC

Add the following code to the CREATED event of DataList, Note: Remove the button here LinkButton, ID is lbdel

Private void DataList1_itemcreated (Object Sender, System.Web.ui.WebControls.DatalistiteMeventArgs E)

{

IF (E.Item.ItemType == ListItemType.Item || E.Item.ItemType == ListItemType.alternatingItem)

{

LinkButton lbdelete = (linkbutton) E.Item.FindControl ("lbdel");

LBDelete.attributes.add ("onclick", "RETURN CONFIRM (/" OK Delete this? / ");");

}

}

转载请注明原文地址:https://www.9cbs.com/read-48950.html

New Post(0)