GridView delete datarow

G

Guest

HI All:

I have problem to delete row in grid view. It always needs to click twice
delete button to delete row. but everytime it fires the deleting and deleted
event.

I have no idea why the first time doesn't actually work.

Any helps are appreciated.

Cheers

Nick
 
G

Guest

Hi Alvin,

I just add a imagebutton in the gridview, which perform deletion.

Alvin Bruney said:
How have you setup the delete? By wiring or you added your own button?

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
-------------------------------------------------------


Nick said:
HI All:

I have problem to delete row in grid view. It always needs to click twice
delete button to delete row. but everytime it fires the deleting and
deleted
event.

I have no idea why the first time doesn't actually work.

Any helps are appreciated.

Cheers

Nick
 
G

Guest

Hi Reym,

Thanks your reply. I worked out this issue by setting up DataNameKey
property of gridview and then delete the <Delete Parameter> tage in Html file.

I used to use FormParameter to obtain the data row ID, then in the
_RowCommand event i call SQLDataSource.delete() , i still don't know why i
need to click twice click button to delete data.

Cheers

Nick
 
A

Alvin Bruney [MVP]

Several things may cause this and I don't know which one is associated with
your code but the typical case is that the button event fires its own click
followed by the itemdatabound event. Or it may be that you aren't checking
for postback. Rather than debug this, i'd suggest you wire up the grid using
the automatic delete capabilities of the gridview control. It's there, it
works correctly and requires no code so why are you building your own?
--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/blogs/alvin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top