Add double-click event to the DataGrid unit line

zhaozj2021-02-16  52

Add double-click event to the DataGrid unit line

HBZXF (A Ho) http://www.cnblogs.com/hbzxf

Now I need to do the function when I display the data information of the relatively selected time when I click on the DataGrid, and I will pop up the dialog box when you double-click this same line. What should you do? Since the problem is simple, it is no longer elaborated. Let me talk about how to double-click the event.

Here you can use the DataGrid ItemDatabase, we can add the following code to the desired program that you can implement the double click. The detailed source code is as follows:

private void DataGrid1_ItemDataBound (object sender, System.Web.UI.WebControls.DataGridItemEventArgs e) {if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem) || ( E.Item.itemType == ListItemType.selectedItem)) {E.Item.attributes.add ("OnDBLClick", JavaScript: Return Confirm ('OK Delete " E.Item.cells [1] .text "?'? '?'? ' ); ");}}

In fact, it is a tip skill.

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

New Post(0)