473,396 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Delete Button in GridView FooterTemplate

I would like to move the Delete button such that it displays one time in the
footer row, rather than on every row. I've seen lots of questions asked on
the subject around the net, but no answer that seems to solve the problem.

I have tried a few things:
- adding a button, setting it's command name to Delete. Problem with this
is that the CommandArgument value does not get set to the SelectedIndex of
the GridView. Instead it has the value of an empty string. I've tried
binding the CommandArgument to the GridView.SelectedIndex, but that doesn't
seem to work, and I later read that the footer might not support data binding.

- writing javascript to this same button's "onClick" event, basically
replicating the __doPostBack... call that can be found with each inline
Delete button. This method regularly reloads the page, but for some reason I
cannot determine, it only once in a while decides that it wants to delete the
record. The rest of the time, nothing happens but a page reload.

I'm using Visual Web Developer 2005 Express edition, if that makes any
difference.

As a last resort, I'm considering adding some code that will manually call a
delete stored procedure, and manually rebind the GridView, but it was my hope
that I could leverage the SqlDataSource control and GridView control to
perform the work. However, if what I'm trying cannot be done, then I'll
accept that answer, too.

Any ideas, or questions for clarification (or code snippets)?

Thanks in advance,

Jason
Aug 7 '06 #1
1 6360
OK...in a flash of brilliance, I decided to try and double click on the
templated icon in the footer, and Visual Studio kindly generated an
button_Click event for me. In this event I placed
"GridView1.DeleteRow(GridView1.SelectedIndex)" . Works perfectly every time.
Nothing like stumbling on your own easy solution after banging your head
against the wall for days.

I'm going to get an ice pack now.

"JasonK" wrote:
I would like to move the Delete button such that it displays one time in the
footer row, rather than on every row. I've seen lots of questions asked on
the subject around the net, but no answer that seems to solve the problem.

I have tried a few things:
- adding a button, setting it's command name to Delete. Problem with this
is that the CommandArgument value does not get set to the SelectedIndex of
the GridView. Instead it has the value of an empty string. I've tried
binding the CommandArgument to the GridView.SelectedIndex, but that doesn't
seem to work, and I later read that the footer might not support data binding.

- writing javascript to this same button's "onClick" event, basically
replicating the __doPostBack... call that can be found with each inline
Delete button. This method regularly reloads the page, but for some reason I
cannot determine, it only once in a while decides that it wants to delete the
record. The rest of the time, nothing happens but a page reload.

I'm using Visual Web Developer 2005 Express edition, if that makes any
difference.

As a last resort, I'm considering adding some code that will manually call a
delete stored procedure, and manually rebind the GridView, but it was my hope
that I could leverage the SqlDataSource control and GridView control to
perform the work. However, if what I'm trying cannot be done, then I'll
accept that answer, too.

Any ideas, or questions for clarification (or code snippets)?

Thanks in advance,

Jason
Aug 7 '06 #2

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

Similar topics

1
by: Sandy | last post by:
I have a repeater which shows Group names. (Skip this part if you want rather irrelevant) The groups are ordered and formatted: Parent ---Child ------Grand Child (okay start reading again...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
1
by: Jeff | last post by:
ASP.NET 2.0 I've got problems with the right column in my GridView. The GridView consist of 2 columns, the problem column is the column on the right side. The problem is that it looks like...
4
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I have a gridview. I am using template columns inside the gridview. When I display the gridview on the web page and if there is no value in a particular cell, gridline disappaers...
0
by: Eraser | last post by:
Hi to all .NET guru guys... I have a problem in my delete button inside gridview. How to avoid postback on when i select cancel on confirmation message? But postback is okay on Ok confirmation....
2
by: shapper | last post by:
Hello, I am working with a ListView but I suppose that with a GridView might be the same. Instead of having an Insert Button on each GridView row I would like to have only one Insert button,...
3
by: RobertTheProgrammer | last post by:
Hi folks, I've got another problem. Basically, I'm trying to use a nested GridView, however the nexted GridView displays no values (even though in debug I'm getting valid values into my DataSet. ...
2
by: Danielle | last post by:
Hello all - Thank you in advance for any help you are able to provide. I am populating a gridview from a stored procuedure. The returned data is a name, phone number, email and guid of a...
0
parshupooja
by: parshupooja | last post by:
Hey All, I have where I want to do some manipulations and show in other column but unable to find their values in RowDatabound event even though I have two records in gridview <asp:GridView...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...

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.