Different effects are displayed according to the bid data when using Checkbox in DataGrid

xiaoxiao2021-03-06  107

To display different results according to the help data when using Checkbox in DataGrid, you can add the following code in the DataGrid ItemDatabase:

Private void DTGVIEW_ITEMDATABOUND (Object Sender, System.Web.ui.WebControls.DataGriditeMeventArgs E)

{

Int ID;

DataRowView DRV;

Switch (E.Item.ItemType)

{

Case ListItemType.Item:

DRV = (DATAROWVIEW) E.Item.DataItem;

ID = Convert.Toint32 (DRV ["ID"]);

IF (id% 2 == 0)

{

E.Item.cells [0] .enabled = false;

}

Break;

Case ListItemType.AlternatingItem:

Goto Case ListItemType.Item;

DEFAULT:

Break;

}

}

This can be realized, when the ID is an even number, checkbox is not available, odd, is available.

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

New Post(0)