473,698 Members | 2,182 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CsvDataSource : how to extend the example so it calls handle delete?

I am studying ASP.NET I am trying to use this example

http://msdn.microsoft.com/en-us/libr...atasource.aspx

but for practice I want to extend it so it handles deletes.

I have this

using System;
using System.Data;
using System.Configur ation;
using System.Web;
using System.Web.Secu rity;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.W ebControls.WebP arts;
using System.Web.UI.H tmlControls;

public partial class _Default : System.Web.UI.P age
{
CsvDataSource cds = null;
protected void Page_Load(objec t sender, EventArgs e)
{
if (cds == null)
{
cds = new CsvDataSource() ;
}
cds.FileName = "~/App_Data/CSVTextFile.csv ";
cds.IncludesCol umnNames = true;
GridView1.AutoG enerateDeleteBu tton = true;
// GridView1.RowDe leting += new
GridViewDeleteE ventHandler(gv_ RowDeleting);
GridView1.DataS ource = cds;
GridView1.DataB ind();
}

void gv_RowDeleting( Object sender, GridViewDeleteE ventArgs e)
{
ClientScript.Re gisterStartupSc ript(GetType(), "MyAlert2",
"alert('Deletin g');", true);
}
}

And I have changed this in the CSVDataSource Example

public override bool CanDelete
{
get
{
return true; //changed this
}
}

And have to do some stuff here that I know
protected override int ExecuteDelete(I Dictionary keys, IDictionary values)
{
throw new NotSupportedExc eption();
}
But the Execute Delete is not called. What more do I have to do to get the
GridView know that the CsvDataSource handles deletes? I am not getting this
exception:

NotSupportedExc eption: Specified method is not supported.]
System.Web.UI.D ataSourceView.E xecuteDelete(ID ictionary keys, IDictionary
oldValues) +28
System.Web.UI.D ataSourceView.D elete(IDictiona ry keys, IDictionary
oldValues, DataSourceViewO perationCallbac k callback) +75
System.Web.UI.W ebControls.Grid View.HandleDele te(GridViewRow row, Int32
rowIndex) +927

But this exception:

System.Web.UI.W ebControls.Grid View.OnRowDelet ing(GridViewDel eteEventArgs e)
+325
System.Web.UI.W ebControls.Grid View.HandleDele te(GridViewRow row, Int32
rowIndex) +732

MarcWentink

Aug 30 '08 #1
0 846

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

52
27008
by: Newsnet Customer | last post by:
Hi, Statement 1: "A dynamically created local object will call it's destructor method when it goes out of scope when a procedure returms" Agree. Statement 2: "A dynamically created object will call it's destructor when it is made a target of a delete".
1
2604
by: Pelle | last post by:
Hello all, I have to admit, that the idea that occurred to me recently is weird. It was somehow inspired by the huge response on the "delete operator" thread, but goes into a somewhat different direction. From my understanding there are 2 "ways" of handling memory: -- one (from C) is the malloc/realloc/free set of API functions -- the other one (from C++) is the new/new/delete/delete set of API functions.
4
2787
by: MAB71 | last post by:
I'm running an ISP database in SQL 6.5 which has a table 'calls'. When the new month starts I create a new table with the same fields and move the data of previous month into that table and delete it from calls. So 'calls' holds the data of only the current month. for example at the start of november 2003 I ran the queries Create Table Oct2003Calls { ................ ................
20
4145
by: Ioannis Vranos | last post by:
When we use the standard placement new operator provided in <new>, and not a definition of owr own, isn't a call to placement delete enough? Consider the code: #include <new>
6
1864
by: Jay Nabonne | last post by:
Hi, This might sound odd, but we want to replace the allocation scheme used by new and delete without changing operator new and operator delete. (The global operators are shared and we can't change them.) We can replace operator new functionality by providing additional parameters to the new function call (ala Stroustrup): class foo_t;
10
2242
by: MaxMax | last post by:
int *p; p = new int; void *q = (void*)p; delete q; Is this valid if p is guaranteed to be a POD? (don't ask why... there is a reason I need this. Clearly I will create p in function, use p in another function that know what type p is and delete p in a function that for simplicity won't know what p is)
9
8165
by: rohits123 | last post by:
I have an overload delete operator as below ////////////////////////////////// void operator delete(void* mem,int head_type) { mmHead local_Head = CPRMemory::GetMemoryHead(head_type); mmFree(&local_Head,(char *)mem); CPRMemory::SetMemoryHeadAs(local_Head,head_type); } ///////////////////// void* operator new(size_t sz, int head_Type) {
29
2261
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello everyone, I remembered delete is implemented through operator overloading, but I am not quite clear. Could anyone recommend some links about how delete is implemented so that I can learn and refresh my memory? :-)
4
1835
by: mail.dsp | last post by:
Suppose in a class we overload four operators: operator new operator delete operator new operator delete class Test{ public: void * operator new (size_t t){ cout<<"\nCalling... new";
0
8601
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9021
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7716
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4365
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.