DataGrid Delete Confirmation and Item Color Alternation

zhaozj2021-02-16  96

?????????? Sometimes we need to display the data corresponding to the Item in the DataGrid, you need to pop up a confirmation dialog to prompt the user. In fact, this feature is very simple, the following code can try, There is also a tip that also tests, can generate color alternating effects in DataGrid Item? ????

? private void DG_ItemDatabase (Object sender, DataGriditeMeventargs e) ?? {??? if (E.Item.itemType == ListItemType.Item || E.Item.itemType == ListItemType.alternatingItem) ??? {? // Delete Confirmation ???????????????? LinkButton DelbTTN = (LinkButton) E.Item.cells [1] .controls [0]; ???? Delbttn.attributes.add ("onclick" , "JavaScript: Return Confirm (Determined" E.Item.cells [4] .Text "? ');"); ?? // Color Alternation ??????? E.Item.attributes. Add ("OnMouseOver", "this.style.backroundcolor = 'seasonell'); ???? if (E.Item.ItemType == ListItemType.Item) ???? {????? E.Item. Attributes.add ("onmouseout", "this.style.backroundcolor = '# fffff'"); ????}

???? if (E.Item.itemType == ListItemType.alternatingItem) ???? {????? E.Item.attributes.add ("onmouseout", "this.style.backcoldcolor = 'seasonell'" ); ????} ???} ??}

Thank you, my friend Xiaolin has provided technical support here, he is an excellent software engineer.

?

?

Author Blog:

http://blog.9cbs.neet/hbzxf/

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

New Post(0)