Add a double-click event to the DataGrid unit row
Hbzxf (Hao)
Now, what I need to do is to display the corresponding data information when I click a row in the DataGrid. When I double-click the same row, the delete dialog box is displayed. What should I do. Since the clicking problem is simple, I will not elaborate on it anymore. Next I will explain how double-click events are implemented.
The itemdatabound event of the DataGrid is used here.CodeAdd to the requiredProgramDouble-click. The detailed source code is as follows:
Private void maid (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 ('Confirm to delete" + E. Item. cells [1]. Text + "? ');");
}
}
It's actually a little trick.