Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem of link and delete click prompt in Gridview

Shulou Source: shulou.com Published: 2022-06-03 06:36:08 09月21日 Update

This article will explain in detail how to solve the problem of link and delete click prompt in Gridview. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.

For example: Gridview has two columns: cancel and delete, click and prompt before execution.

The code is as follows:

If you bind the prompt like this in the background:

The code is as follows:

E.Row.Cells [6] .Attributes.add ("onclick", "return confirm ('are you sure you want to cancel?")

E.Row.Cells [7] .Attributes.add ("onclick", "return confirm ('are you sure you want to delete this data?)")

This is a cell binding event for Gridview. If you don't click on the text, just click on the cell where the text is located, and the prompt will pop up, which is very unfriendly.

Solution:

The code is as follows:

((HyperLink) e.Row.Cells [6] .controls [0]) .Attributes.Add ("onclick", "return confirm ('are you sure you want to cancel?'))

((LinkButton) e.Row.Cells [7] .controls [0]) .Attributes.Add ("onclick", "return confirm ('are you sure you want to delete this data?')")

This is the end of this article on "how to solve the problem of links and deleting clicks in Gridview". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

Tags: Tips code articles links questions units data text more good practical events content background articles methods knowledge references help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Shulou Technology vpn NVidia macOS