473,320 Members | 1,846 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,320 software developers and data experts.

gridview edit and delete

J
I like the Edit (Update, Cancel) functionality built into the gridview, but
I'd like to control what happens when the Update is clicked. I would like
to prompt the user with something like this "category has changed from
'something' to 'something else', shall I process related records? (yes/no)".
I would also like to confirm when a user clicks Delete.

Here's how I currently have the gridview configured:

<asp:GridView ID="gvMyGridView" runat="server" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="BigId" DataSourceID="sdsMonday">
<Columns>
<asp:BoundField DataField="Stage" HeaderText="Description"
SortExpression="Stage" />
<asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>

Thanks.

Jun 27 '08 #1
1 1423
Convert the column in question into a template and then do something like
this:

<ItemTemplate>
<asp:LinkButton ID="lnkDelete" runat="server" CausesValidation="false"
CommandName="Delete" Text="Delete"
OnClientClick="return confirm('Are you sure you want to delete this
record?');" />
</ItemTemplate>

--
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"J" <no****@nowhere.comwrote in message
news:17******************************@posted.nuvox communications...
>I like the Edit (Update, Cancel) functionality built into the gridview, but
I'd like to control what happens when the Update is clicked. I would like
to prompt the user with something like this "category has changed from
'something' to 'something else', shall I process related records?
(yes/no)". I would also like to confirm when a user clicks Delete.

Here's how I currently have the gridview configured:

<asp:GridView ID="gvMyGridView" runat="server" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="BigId" DataSourceID="sdsMonday">
<Columns>
<asp:BoundField DataField="Stage" HeaderText="Description"
SortExpression="Stage" />
<asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>

Thanks.
Jun 27 '08 #2

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

Similar topics

3
by: | last post by:
Hello, I have created an ASP.NET 2.0 application that utilized a Gridview Control to display and update/delete data. The problem I am having is that the gridview control is displaying the data...
2
by: Robert Smith jr. | last post by:
Hello, Please pardon my newbie question ... I am building an ASP.NET page that displays a recordset with a Delete statement enabled (this all works fine). I want to Insert the current row...
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....
3
by: Simon Strandgaard | last post by:
Hi group, my setup: I have a GridView that extracts data from my table (a SqlDataSource). For each row, I have an 'edit' button and a 'delete' button. The 'edit' button opens a popup, through...
1
by: Mike P | last post by:
When you use a SqlDataSource to hook up data to a GridView it seems to be to be very inflexible. For example, I want to create my own Delete button with my own code and I also want to create a...
1
by: Marc | last post by:
Hi, I made a detailsview for inserting records. I also made a gridview for editing and deleting the same records. The keyfield is an autonumbering field in Access (pcnr). My problem is: I can...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
4
by: Tom | last post by:
I need to grab the text from a cell in my gridview and pass it in my querystring I need to do this on the client
4
by: Jonathan Wood | last post by:
Greetings, I have a GridView control. For a couple of reasons, I ended up with a TemplateField to contain my Edit and Delete links, something like this: <asp:TemplateField ShowHeader="False">...
5
by: sandhyascs | last post by:
Hi everyone I’m using the GridView in asp.net and populating the grid dynamically using c#.net.To edit the rows i i m using GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.