SlideShare a Scribd company logo
Popup a ConfirmationBox before deleting arow in Gridview
1. Drag and Drop a Gridviewtothe WebForm.Attacha database table intothe GridView.The
followinglinkgivesdetailsof addingadatabase table intothe GridView,
https://www.slideshare.net/DharmaRaju2/how-to-add-sql-server-table-into-dot-net-web-
page-gridview
We can easilyadd ‘Delete’ buttonintothe GridView byselecting‘Enable Deleting’option
fromthe GridViewTasklist.But, the ‘Delete’buttonaddedbythismethodwon’taskfor
confirmationfromuserswhenitisclicked. Itsimplydeletesthe row whenwe press‘Delete’
button.But,by addingconfirmationoption,accidentaldeletionof rowsisprevented.
Here are the steps:
2. Clickon TaskButton  Clickon ‘AddNew Column’
3. SelectTemplate FieldfromFieldType
4. Enter a HeaderText,say‘Delete’.PressOKbutton
5. You can see Grid Viewwithanew column – ‘Delete’
6. Now,Switch the displayof the webpage to‘Source’mode. Findbelow line:
<asp:TemplateField HeaderText="Delete"></asp:TemplateField>
Breakthe above linesintotwoandinsertfew blanklines asshownbelow:
<asp:TemplateField HeaderText="Delete">
</asp:TemplateField>
7. Insertcode inbetweenthe above twolinesasshownbelow:
<asp:TemplateField HeaderText="Delete">
<ItemTemplate>
<asp:Button ID="btnDel" runat="server" Text="Delete"
CommandName="Delete" OnClientClick="return
confirm('Are you sure you want to delete this row?');" />
</ItemTemplate>
</asp:TemplateField>
8. Notice ‘Delete ‘Button’ insertedonall rowsof the GridView.
9. Openthe webpage ina browser.Clickondeletebutton. The systempromptsyoutoconfirm
whetheryoureallywantyoutodelete thatrow.Press OKto confirm.
10: Insteadof Button,youcan adda linkbuttonbychanging<Asp:Buttonto<asp:LinkButtonas
sownbelow:
<ItemTemplate>
<asp:LnkButton ID="btnDel" runat="server" Text="Delete"
CommandName="Delete" OnClientClick="return
confirm('Are you sure you want to delete the record?');" />
</ItemTemplate>
In my opinion, LinkButton looks better than Button in a GridView. See the Figure
above.
=== 0 ===

More Related Content

Similar to Popup confirmation for Delete Button in GridView

Grid view control
Grid view controlGrid view control
Grid view control
Paneliya Prince
 
Grid Vew Control VB
Grid Vew Control VBGrid Vew Control VB
Grid Vew Control VB
sunmitraeducation
 
Qlikview Quick Start
Qlikview Quick StartQlikview Quick Start
Qlikview Quick Start
Qasir Riaz SharePoint Consultant
 
Bootstrap with liferay
Bootstrap with liferayBootstrap with liferay
Bootstrap with liferay
Sendhil Kumar Kannan
 
Grid View Control CS
Grid View Control CSGrid View Control CS
Grid View Control CS
sunmitraeducation
 
Chapter12 (1)
Chapter12 (1)Chapter12 (1)
Chapter12 (1)
Rajalaxmi Pattanaik
 
Chapter 16
Chapter 16Chapter 16
IntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdfIntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdf
David Harrison
 
IntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdfIntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdf
David Harrison
 
SAP HANA -Analytic view creation
SAP HANA -Analytic view creationSAP HANA -Analytic view creation
SAP HANA -Analytic view creation
Deepak Chaubey
 
Creating a dot netnuke
Creating a dot netnukeCreating a dot netnuke
Creating a dot netnuke
Nguyễn Anh
 
How to create drill down dashboard
How to create drill down dashboardHow to create drill down dashboard
How to create drill down dashboard
Nilesh Jethwa
 
Quick View For Magento 2
Quick View For Magento 2 Quick View For Magento 2
Quick View For Magento 2
MageAnts
 
IBM developerWorks Cloud Trial – 90 days
IBM developerWorks Cloud Trial – 90 daysIBM developerWorks Cloud Trial – 90 days
IBM developerWorks Cloud Trial – 90 days
IBM India Smarter Computing
 
Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docxLab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
smile790243
 
Journey to Azure Sentinel
Journey to Azure SentinelJourney to Azure Sentinel
Journey to Azure Sentinel
Cheah Eng Soon
 
Database development connection steps
Database development connection stepsDatabase development connection steps
Database development connection steps
Aravindharamanan S
 
Hands on With Advanced Data Grid
Hands on With Advanced Data GridHands on With Advanced Data Grid
Hands on With Advanced Data Grid
OutSystems
 
Database Connection
Database ConnectionDatabase Connection
Database Connection
John Joseph San Juan
 
GWT training session 2
GWT training session 2GWT training session 2
GWT training session 2
SNEHAL MASNE
 

Similar to Popup confirmation for Delete Button in GridView (20)

Grid view control
Grid view controlGrid view control
Grid view control
 
Grid Vew Control VB
Grid Vew Control VBGrid Vew Control VB
Grid Vew Control VB
 
Qlikview Quick Start
Qlikview Quick StartQlikview Quick Start
Qlikview Quick Start
 
Bootstrap with liferay
Bootstrap with liferayBootstrap with liferay
Bootstrap with liferay
 
Grid View Control CS
Grid View Control CSGrid View Control CS
Grid View Control CS
 
Chapter12 (1)
Chapter12 (1)Chapter12 (1)
Chapter12 (1)
 
Chapter 16
Chapter 16Chapter 16
Chapter 16
 
IntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdfIntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdf
 
IntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdfIntoTheNebulaArticle.pdf
IntoTheNebulaArticle.pdf
 
SAP HANA -Analytic view creation
SAP HANA -Analytic view creationSAP HANA -Analytic view creation
SAP HANA -Analytic view creation
 
Creating a dot netnuke
Creating a dot netnukeCreating a dot netnuke
Creating a dot netnuke
 
How to create drill down dashboard
How to create drill down dashboardHow to create drill down dashboard
How to create drill down dashboard
 
Quick View For Magento 2
Quick View For Magento 2 Quick View For Magento 2
Quick View For Magento 2
 
IBM developerWorks Cloud Trial – 90 days
IBM developerWorks Cloud Trial – 90 daysIBM developerWorks Cloud Trial – 90 days
IBM developerWorks Cloud Trial – 90 days
 
Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docxLab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
Lab StepsSTEP 1 Login Form1. In order to do this lab, we need.docx
 
Journey to Azure Sentinel
Journey to Azure SentinelJourney to Azure Sentinel
Journey to Azure Sentinel
 
Database development connection steps
Database development connection stepsDatabase development connection steps
Database development connection steps
 
Hands on With Advanced Data Grid
Hands on With Advanced Data GridHands on With Advanced Data Grid
Hands on With Advanced Data Grid
 
Database Connection
Database ConnectionDatabase Connection
Database Connection
 
GWT training session 2
GWT training session 2GWT training session 2
GWT training session 2
 

More from Dharma Raju

Master slave control in gridview
Master   slave control in gridviewMaster   slave control in gridview
Master slave control in gridview
Dharma Raju
 
Change row colour based on some condition
Change row colour based on some conditionChange row colour based on some condition
Change row colour based on some condition
Dharma Raju
 
Windows Communication Foundation (WCF) programming using Visual Studio
Windows Communication Foundation (WCF) programming using Visual StudioWindows Communication Foundation (WCF) programming using Visual Studio
Windows Communication Foundation (WCF) programming using Visual Studio
Dharma Raju
 
Internal tables in sap
Internal tables in sapInternal tables in sap
Internal tables in sap
Dharma Raju
 
Govina haadu
Govina haaduGovina haadu
Govina haadu
Dharma Raju
 
Coffee
CoffeeCoffee
Coffee
Dharma Raju
 

More from Dharma Raju (6)

Master slave control in gridview
Master   slave control in gridviewMaster   slave control in gridview
Master slave control in gridview
 
Change row colour based on some condition
Change row colour based on some conditionChange row colour based on some condition
Change row colour based on some condition
 
Windows Communication Foundation (WCF) programming using Visual Studio
Windows Communication Foundation (WCF) programming using Visual StudioWindows Communication Foundation (WCF) programming using Visual Studio
Windows Communication Foundation (WCF) programming using Visual Studio
 
Internal tables in sap
Internal tables in sapInternal tables in sap
Internal tables in sap
 
Govina haadu
Govina haaduGovina haadu
Govina haadu
 
Coffee
CoffeeCoffee
Coffee
 

Recently uploaded

国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
zoowe
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
fovkoyb
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
cuobya
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
uehowe
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
Paul Walk
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
ysasp1
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
uehowe
 
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdfMeet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Florence Consulting
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
Laura Szabó
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
cuobya
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
Toptal Tech
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
xjq03c34
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
Trending Blogers
 
Azure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdfAzure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdf
AanSulistiyo
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
wolfsoftcompanyco
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
bseovas
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
vmemo1
 
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
bseovas
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
Trish Parr
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
SEO Article Boost
 

Recently uploaded (20)

国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
国外证书(Lincoln毕业证)新西兰林肯大学毕业证成绩单不能毕业办理
 
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
存档可查的(USC毕业证)南加利福尼亚大学毕业证成绩单制做办理
 
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
可查真实(Monash毕业证)西澳大学毕业证成绩单退学买
 
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
留学挂科(UofM毕业证)明尼苏达大学毕业证成绩单复刻办理
 
Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?Should Repositories Participate in the Fediverse?
Should Repositories Participate in the Fediverse?
 
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
成绩单ps(UST毕业证)圣托马斯大学毕业证成绩单快速办理
 
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
办理毕业证(UPenn毕业证)宾夕法尼亚大学毕业证成绩单快速办理
 
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdfMeet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
Meet up Milano 14 _ Axpo Italia_ Migration from Mule3 (On-prem) to.pdf
 
Gen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needsGen Z and the marketplaces - let's translate their needs
Gen Z and the marketplaces - let's translate their needs
 
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
假文凭国外(Adelaide毕业证)澳大利亚国立大学毕业证成绩单办理
 
Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!Ready to Unlock the Power of Blockchain!
Ready to Unlock the Power of Blockchain!
 
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
办理新西兰奥克兰大学毕业证学位证书范本原版一模一样
 
Explore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories SecretlyExplore-Insanony: Watch Instagram Stories Secretly
Explore-Insanony: Watch Instagram Stories Secretly
 
Azure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdfAzure EA Sponsorship - Customer Guide.pdf
Azure EA Sponsorship - Customer Guide.pdf
 
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaalmanuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
manuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaal
 
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
不能毕业如何获得(USYD毕业证)悉尼大学毕业证成绩单一比一原版制作
 
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
重新申请毕业证书(RMIT毕业证)皇家墨尔本理工大学毕业证成绩单精仿办理
 
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
留学学历(UoA毕业证)奥克兰大学毕业证成绩单官方原版办理
 
Search Result Showing My Post is Now Buried
Search Result Showing My Post is Now BuriedSearch Result Showing My Post is Now Buried
Search Result Showing My Post is Now Buried
 
Understanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdfUnderstanding User Behavior with Google Analytics.pdf
Understanding User Behavior with Google Analytics.pdf
 

Popup confirmation for Delete Button in GridView

  • 1. Popup a ConfirmationBox before deleting arow in Gridview 1. Drag and Drop a Gridviewtothe WebForm.Attacha database table intothe GridView.The followinglinkgivesdetailsof addingadatabase table intothe GridView, https://www.slideshare.net/DharmaRaju2/how-to-add-sql-server-table-into-dot-net-web- page-gridview We can easilyadd ‘Delete’ buttonintothe GridView byselecting‘Enable Deleting’option fromthe GridViewTasklist.But, the ‘Delete’buttonaddedbythismethodwon’taskfor confirmationfromuserswhenitisclicked. Itsimplydeletesthe row whenwe press‘Delete’ button.But,by addingconfirmationoption,accidentaldeletionof rowsisprevented. Here are the steps: 2. Clickon TaskButton  Clickon ‘AddNew Column’ 3. SelectTemplate FieldfromFieldType 4. Enter a HeaderText,say‘Delete’.PressOKbutton 5. You can see Grid Viewwithanew column – ‘Delete’ 6. Now,Switch the displayof the webpage to‘Source’mode. Findbelow line: <asp:TemplateField HeaderText="Delete"></asp:TemplateField> Breakthe above linesintotwoandinsertfew blanklines asshownbelow: <asp:TemplateField HeaderText="Delete"> </asp:TemplateField> 7. Insertcode inbetweenthe above twolinesasshownbelow: <asp:TemplateField HeaderText="Delete"> <ItemTemplate> <asp:Button ID="btnDel" runat="server" Text="Delete" CommandName="Delete" OnClientClick="return confirm('Are you sure you want to delete this row?');" /> </ItemTemplate> </asp:TemplateField> 8. Notice ‘Delete ‘Button’ insertedonall rowsof the GridView. 9. Openthe webpage ina browser.Clickondeletebutton. The systempromptsyoutoconfirm whetheryoureallywantyoutodelete thatrow.Press OKto confirm.
  • 2. 10: Insteadof Button,youcan adda linkbuttonbychanging<Asp:Buttonto<asp:LinkButtonas sownbelow: <ItemTemplate> <asp:LnkButton ID="btnDel" runat="server" Text="Delete" CommandName="Delete" OnClientClick="return confirm('Are you sure you want to delete the record?');" /> </ItemTemplate> In my opinion, LinkButton looks better than Button in a GridView. See the Figure above. === 0 ===