Add double-click event hbzxf to the row of the DataGrid (original)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.