The more and more I use the GridView control, the more I end up writing my own
rather then using the DataBound columns because of the additional flexiblity you get when writing your own templates.
This time I ended up writing my own TemplateField because I need to add a confirm pop up to basically a “delete” command (it didn’t really delete the database record but in fact flagged it as a different type)… but you get the idea where this might come in handy. After all you don’t want users calling saying “Yeah, I just deleted something I didn’t mean to”. Instead you want to pop up a javascript box with a “Do you really want to do this…because I am not fixing it again!”
Unfortunetly the
doesn’t offer you an onClientClick
event, so this is my work around.
Here is the basic Javascript code to pop up a confirm button.
<SCRIPT LANGUAGE=”JavaScript”>
function confirmSubmit() {
var agree=confirm(“Do you really want to mark this prospect as in the database?”);
if (agree)
return true ;
else
return false ;
}
</SCRIPT>
Now in your GridView->Column Tag add a
and your onClientClick attribute. This will call your Javascript function above and display a confirm popup to your users. You also must define a onClick event that points to a function that you will need to create for the server side processing of this request.
<asp:TemplateField>
<ItemTemplate>
<asp:Button ID=”btnCustomerExist”
text=”customer exist”
Runat=Server
OnClick=”CustomerAlreadyExist”
OnClientClick=”return confirmSubmit()”
Width=”100″ />
</ItemTemplate>
</asp:TemplateField>
If the user clicks “OK” on the popup, you will need to handle the server side processing. I tend to write my own Data Access layer to handle Selects and Deletes so for me it is pretty straight forward from here, I call a function and pass in the unique id from the database.
Public Sub CustomerAlreadyExist(ByVal sender As Object, ByVal e As EventArgs)
Dim ProspectID As Int32
Dim btnRemoveProspect As Button = CType(sender, Button)
Dim grdRow As GridViewRow = CType(btnRemoveProspect.Parent.Parent, GridViewRow)
‘Get ID
ProspectID = grdRow.Cells(0).Text
‘Instant Class
myAddProspect = New AddProspect()
‘Removes from Prospect Table
myAddProspect.RemoveFromDatabase(ProspectID)
‘Refresh Gridview
Page_Load(sender, e)
End Sub
The End Result
Of course this won’t stop everyone from accidentally deleting users but it will stop 9/10.
888 Casino Login Mobile Reviews Italy Non si può mai sbagliare se si decide sul casinò online. Dal momento che le tue possibilità di vincita sono più alte e hai il controllo sui tuoi account, sarai sicuro che tutto può essere al di sotto della gestione. Non c’è sentimento più alto di quello di essere sotto la gestione.
Crypto Soft Bewertung : Ein durchschnittlicher Bullion Händler Gebühren in der Regel überall von vielen Prozent zu fortypercent oder zusätzlich über Wert. (in nur ein bisschen werde ich Ihnen zeigen, wie Sie Sie für 0P. c über Wert zu kaufen. Wirklich. Bleiben Sie dran.) Um den Listenwert einer numismatischen Münze zu ermitteln, werden die Münzen durch Benotungs Dienste benotet. 3 der am meisten Benotung Dienstleistungen sind; ANACS, PCGS und NCG.
Visit cryptosoftbewertung
i will practice it in my site. thanks for all
Here the Indian Escorts in Dubai is out with the attractive look, sharp eyes and fine haircut that let the general population to men to appreciate such the services.
i really need that code. thanks for this information. If you want property, house plot in Bahria Enclave which is located in Islamabad then visit Advice.pk to get complete knowledge and details. Bahria Town Islamabad/ Rawalpindi are Pakistan’s number one housing schemes.
that’s very cool. your blog helped me a lot. please visit wSmartBazar.pk to get latest and cool women’s dresses by free home delivery.
I have practice it and work. thanks for share it. send me email if you have another like this.
good is information
paket Umroh Plus Aqsa
Paket Umroh januari 2019
Biro perjalanan umroh
It is really a nice and helpful piece of info. I am glad that you shared this helpful info with us. Please keep us up to date like this. Thank you for sharing
We have a three-part technology to defend against chargebacks. Using our technology frees you up to concentrate on your business and keeps up your merchant account so that you can grow your business.
adobe support number – Adobe is an American multinational software company which is well known for its creation of multimedia and creativity software products.
Norton.com/setup Online Help – To enable this protection for your Windows or Mac PC, all you need to do is download, install and activate the Norton Setup. But, before you start with the downloading process, remember to uninstall the already installed security software or antivirus (if any) from your device. This is mandatory to avoid any software conflict issue.
norton.com/setup
http://www.webroot.com/safe – Activate Your Webroot Safe today by just visiting Webroot.com/Safe as installing Webroot is a snap.www.webroot.com/safe You may download, open, enter keycode & get protected by Webroot Com Safe.
http://www.webroot.com/safe
#reinstall_webroot #webroot_keycode #webroot_secureanywhere_keycode #webroot_antivirus #install_webroot_with_keycode
Click and download norton.com/setup to install Norton antivirus on your computer.Activate your norton activation key for norton setup
Get started with Norton Setup for norton security antivirus software for all around 360 security. Activate product key for norton.com/setup Office.com/Setup
Norton.com/Setup
McAfee.com/activate – McAfee Activate at http://www.mcafee.
com/activate, enter your product key for mcafee.com/activate
online. Get Started with McAfee Activation.
Install Office Setup – Sign-in to you microsoft account and then Enter 25 digit alphanumeric office setup product key on country and language.click on next to start office installation.We are the best Office Setup in US, Canada and Australia. At Office Setup, we put high effort, moderate IT answers for organization’s, and people.Whether set up or beginning, equipment or programming, system or electronic, we have something for each financial plan. officeplus.net is the exchanging name of Spacesolutions Pvt Ltd situated in California, USA. We are not Microsoft. However we are trained professionals to provide technical support for We are the world’s biggest innovation wholesaler and a main innovation deals, showcasing and logistics organization for the IT business around the world. Our people group based ethos, focused costs and nature of administration settles on Office Setup the right decision for your IT needs .Whether you are a learner or experienced in IT our courses are altered to furnish you with the key achievement criteria to thrive in future attempts.
http://www.office.com/setup
Thank you for giving post here and telling everyone else knows
http://www.kizi10player.com
Sometimes Microsoft Office users face the issues after upgrading their Windows operating system. If you are also facing such type of issues related to your Microsoft Office setup installation then contact us at office.com/setup for the best support.
office.com/setup
Thanks for sharing such a great information with us. Your Post is very unique and all information is reliable for new readers. Keep it up in future, thanks for sharing such a useful post. Our toll-free number is accessible throughout the day and night for the customer if they face any technical issue in BROTHER PRINTER Call us +1888-621-0339 Brother Printer Support USA Brother Printer Customer Care Number
This Australia assignment help is one of the world’s driving suppliers of scholastic help to understudies of all age and instructive levels.
Hello! This is my first visit to your blog! This is my first comment here, so I just wanted to give a quick shout out and say I genuinely enjoy reading your articles. Your blog provided us useful information. You have done an outstanding job.
malaysia visa for indians
Hi..! Good day, we are from best pizza oven website. I saw this post and figure out that, it is really good post, wonderful presentation. keep going…..
very nice
Very nice post.
Thanks for sharing an informative post.
Thanks for sharing such a great information with us. Your Post is very unique and all information is reliable for new readers. Keep it up in future, thanks for sharing such a useful post. Our toll-free number is accessible throughout the day and night for the customer if they face any technical issue in BROTHER PRINTER Call us +1888-621-0339 Brother Printer Support USA Brother Laser Printer
Brother Printer
Brother Printer Driver Download
MS office Teams unites everything a group needs in a single place. You can coordinate the applications and administrations you require, including Office 365 applications like Excel or countless gathering applications. visit office.com/setup for Download, Installation and Activation Microsoft Office.
http://officecomoffice.com/
In case you wish to download and install the tool then you may need to visit the link norton.com/setup. The Norton 360 Antivirus helps you to detect, prevent and block the malicious sites or online threats. Here in this article, we will discuss the process to Unblock Website Norton 360 Antivirus.
http://nortonnortoncom.com/
when you need to visit office.com/setup to Download, setup and install.Office 2019 will be the next upgraded version of PowerPoint, Excel, Word, Access, Outlook, Visio and Publisher. These new applications have already been introduced in the market on 24th September. http://officeofficecom.com/
After visiting the norton.com/setup, access your account, manage your subscription, and extend your Norton protection to PC, Mac, Android and iOS. http://www.Norton.com/setup: Learn, how to download and setup Norton Antivirus software For Windows and Mac OS PC/Laptop.
http://nortoncomnorton.com
webroot.com/safe Setup Enter your product key online. Create or log into your Webroot account here. Manage your security across multiple devices, with any Webroot product webroot safe.
http://www.webroot-webroot.com
Office.com/setup – Check out the easy steps for installing, ownloading, activation and re-installing the Microsoft office at http://www.office.com/setup. MS Office Products like Office 365 Home, Office 2016 Business Premium, Office Professional 2016, Renew your Office, Office 365 Personal etc.
http://officecom.org
Microsoft office setup is the full suite of Microsoft efficiency programming that joins an assortment of utilizations, administrations, and server like Excel, PowerPoint, Word, OneNote, Publisher and Access. Aside from the working frameworks, these projects are Microsoft’s key items that are generally utilized programming on the planet. Microsoft Office.com/Setup bundles all the best programming that Microsoft brings to the table. http://officecom-office.com
we have a team that can produce quality essays that saves you from poor grades.
Nice post!
Get Step-by-Step guide for Office – Activate, Download & complete installation from office.com/setup and get the best security setup for any of your preferred devices just by visiting mcafee.com/activate & norton.com/setup .
Canon Printer Customer Support is a one-stop solution for printer services. We are proud of delivering instant and highly effective services at any hour of the day and also the issue is being rectified as well as corrected in real time right in front of you. We are available 24×7 at +1-888-621-0339.
Canon Printer Customer Support
Thanks for post blog and provide good information.I have followed of your article. Please visit my site.
paramedical institute in bihar
Webroot use a computing device for personal use or for your business. You are always under threat. The attackers with their highly advanced technology are waiting for your make a mistake and they will steal your data in a snap.
http://webroot-webrootsafe.com
McAfee Activate – Enter your McAfee Activation Code and Get Started with McAfee at mcafee.com/activate. Enter McAfee Product Key to Activate McAfee Online at McAfee.com/Activate.
http://mcafee-mcafeeactivate.com
office.com/setup, the popular productivity suite includes a number of servers, application, and services. office.com/setup has been developed for Windows, Mac, Android, and iOS operating systems. With office setup 365 as the latest version, the software is being widely used by the consumers and businesses.
http://officecomusa.com
Protecting your devices and managing your norton.com/setup product is as easy as adding a new device in your Norton account. Follow these instructions to install or reinstall your Norton product that is registered to your account.If you have received your Norton product from your service provider.
http://nortoncomusa.com
Find how to download, introduce, activate all renditions of Microsoft Office setup and initiate on
http://www.offiice-com-setup.com/
norton.com/setup-created and conveyed by symantec company, norton is an antivirus programming offering the customers and organizations endpoint assurance to ensure their advanced world.
Thanks for sharing about this .keep it up,nice blog.
Delhi Escorts
Delhi Escort Service
Delhi Escorts Services
Delhi Escort
Delhi Call Girls
Completely introduced premium renditions of Word, Excel, PowerPoint, OneNote, and Outlook with select, new highlights each month.
Visit website:- http://www.office.com/setup
Visit website:- http://www.mcafee.com/activate
Visit website:- http://www.norton.com/setup
Learn, how to download and setup Microsoft office software For Windows and Mac OS PC/Laptop
Positive site, where did u come up with the information on this posting? I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work.
great work, we have a writer that offer online services.
Nice blog, thank you so much for sharing this informative blog. This is really valuable and awesome.