.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Web Links

delete confirmation before gridview row deleting

Posted By:      Posted Date: October 01, 2010    Points: 0   Category :ASP.Net


I have a command field delete button in gridview and i wantto show the delete confirmation  before delteing the row

 <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ButtonType="Image"
                                CancelImageUrl="~/Images/delete.png" UpdateImageUrl="~/Images/save.png" EditImageUrl="~/Images/edit.png"
                                DeleteImageUrl="~/Images/delete.png" CancelText="?????" DeleteText="???" EditText="?????"

View Complete Post

More Related Resource Links

GridView Confirmation Box Using JQuery BlockUI in asp.net

JQuery is the most popular JavaScript library. One of the main reasons for its fame is the plugin architecture. Anyone can create a separate library that leverage the JQuery library. In this article we are going to look at the BlockUI library which is used to block the user screen while performing a task.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

GridView Confirmation Box Using JQuery BlockUI

JQuery is the most popular JavaScript library. One of the main reasons for its fame is the plugin architecture. Anyone can create a separate library that leverage the JQuery library. In this article we are going to look at the BlockUI library which is used to block the user screen while performing a task.

Adding Client-Side Confirmation When Deleting

The JavaScript confirm(string) function displays its string input parameter as the text inside a modal dialog box that comes equipped with two buttons - OK and Cancel (see Figure 1). The confirm(string) function returns a Boolean value depending on what button is clicked (true, if the user clicks OK, and false if they click Cancel).

Add, Edit, update, Delete gridview

The article Add, Edit, update, Delete gridview was added by anjankant on Friday, July 09, 2010.

Thousandas operation we can do on Gridview control. Here I as explaining how we can add new recored and edit of existing record and delete a record in Gridview. Step1 : You can add this gridview in your aspx form. Here some events of Gridview are fired

Edin, New and Delete buttons in gridview?


Hi guys. I have gried view that shows me all info from the table i made. So my SelectCommand works fine. I'v add 3 additional buttons "new", "edit" and "delete" i'v made their query but still have mistake by clicking it in browser. I follow from the book Begginer to Novice 3.5 ASP C# but that's what it's shown. I know something missing. I'v check in the net but not found how to fixed, because i use SqlDataSource. Can you advise how to proceed from here? Here's what i did:

<asp:SqlDataSource ID="SqlDataSource5" runat="server" ProviderName="System.Data.SqlClient" ConnectionString="<%$ ConnectionStrings:ThisIsMyConnection%>"


              SelectCommand = "SELECT * FROM [Resident] WHERE (([FNAME] + ' ' + [LNAME] LIKE '%' + @FANDLNAME + '%'))"


              UpdateCommand = "UPDATE Resident SET FNAME=@FNAME, LNAME=@LNAME, MobileNum=@MobileNum, HomeNum=@HomeNum, OfficeNum=@OfficeNum, FaxNum=@FaxNum WHERE FNAME=@original_FNAME AND LNA

Delete from gridview

I have read about 20 articles and I can't figure out what I have done wrong.  I am trying to delete from a gridview.  Below is the code.  Any help is appreciated. <form runat='server'> <asp:SqlDataSource  ID='dsTest'  Runat='server'  ConnectionString="<%$ ConnectionStrings:myCnn %>"  SelectCommand="SELECT [ID], [Name], [Enabled], [FavoriteColor] FROM tblTest"  UpdateCommand="UPDATE tblTest SET [Name] = @Name, [Enabled] = @Enabled, [FavoriteColor] = @FavoriteColor WHERE ID = @ID"  DeleteCommand="DELETE FROM tblTest WHERE ID = @ID">  <DeleteParameters>   <asp:Parameter    name="ID" />  </DeleteParameters> </asp:SqlDataSource> <asp:GridView  ID="gvTest"  Runat='server'  DataKeyNames='ID'  AutoGenerateColumns='true'  AutoGenerateEditButton='true'  AutoGenerateDeleteButton='true'  DataSourceID="dsTest" /></form>Exception Details: System.Data.SqlClient.SqlException: Must declare the variable '@ID'.

Problem with "Edit" and "Delete" buttons in gridview!

Hi everyone. I have problem with the buttons Edit and Delete in Gridview for very long time and i really need help about it. So i have gridview and sqldatasource. First i try to make this buttons manually and as you will see in sqldatasource 5 and 6 i have these buttons my records show up but the buttons not working. After that i was advised to do it automatically with gridview smart tag options and Generate columns - this is what i did in sqldatasource7 and gridview7. But both ways i need to change the statements with my own because that what they create not works. So select statement works. Now the error that i get in both ways is the same:The GridView 'GridView(the number could be 5,6 or 7)' fired event RowEditing which wasn't handled.See how looks my page:Now here's my code in aspx:<%@ Page Language="C#" Title="Specific Search in Phone Directory" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="serv

Can not set delete up at GridView

Hello:I am trying to add delete, update function to the gridview.After set up sqldatasource, configure the select statement, click next, it showed: test query, then finish.I did not get Advanced SQL generation Optionson the Configure the select statement, there is Advanced button at the right side. However, I clicked, it showed: Advanced SQL Generation Options, but it is disabled.How to enable Advanced SQL Generation Options so that I could set up delete, update etc functions.I am usingMicrosoft visual studio 2005Versioin 8.0.50727.762 (SP.050727-7600)Your help is highly appreciated.

Gridview and delete option - Button click displays message

Hi, I have a gridview connected to a sql database that allows the user to delete the record. I used the ASP.net automatic "options" for this. However, I would like when the user deletes a record, a message (textbox) appears in the form to say the record has been deleted. Please can anyone provide some sample codes?   Thanks in advance. Nijojo.

Gridview Checkbox Delete

this is a duplicate of my other post. The reason for this is I can't view my first topic about this. I tried in my laptop, pc, and also my friend's pc but I can't view the topic. It slows down the browser and will hang.So here it is.My gridview is being generated at runtime by a dataset. My first column is a template field with checkbox, how to delete a selected row? C# please.This is my code but it doesn't work.protected void DeleteSelected_Click(object sender, EventArgs e) { foreach (GridViewRow row in GridView1.Rows) { CheckBox cb = (CheckBox)row.FindControl("RegistrySelector"); { if(cb.Checked) { string id = GridView1.DataKeys[row.RowIndex].Value.ToString(); string del = "delete from EnrollTbl where Register_ID="+id; da = new SqlDataAdapter(del,con); ds = new DataSet(); ds.Clear(); da.Fill(ds); GridView1.DataSource = ds; GridView1.DataBind(); } } }

The delete and edit buttons not working in gridview!

Hi everyone. I have problem with the buttons Edit and Delete in Gridview for very long time and i really need help about it.  So the when i click edit i get in edit mode and when click update the values in the row i was changing disappear but only in the gridview. When check in the Database nothing happens. The delete button not works at all, i mean when click on it only refresh the table. If see something wrong in my code please help. See how looks my page:Now here's my code in aspx:<%@ Page Language="C#" Title="Specific Search in Phone Directory" ... ... ... <asp:SqlDataSource ID="SqlDataSource7" runat="server" ConnectionString="<%$ ConnectionStrings:ThisIsMyConnection2 %>" OldValuesParameterFormatString="original_{0}" DeleteCommand="DELETE FROM [Resident] WHERE [MobileNum] = @MobileNum" InsertCommand="INSERT INTO [Resident] ([FNAME], [LNAME], [MobileNum], [HomeNum], [OfficeNum], [FaxNum]) VALUES (@FNAME, @LNAME, @MobileNum, @HomeNum, @OfficeNum, @FaxNum)" SelectCommand = "SELECT * FROM [Resident] WHERE (([FNAME] + ' ' + [LNAME] LIKE '%' + @FANDLNAME + '%'))" UpdateCommand=

Gridview Delete not working

I just downloaded VS2010 with Framework 4.0.30319 I've bound a gridview control to a datasource, defined the select, insert, and delete SQL statements. Select and insert are working just fine thank you, but when I select the (auto-generated) Delete link, a postback occurs, but the row/record remains in the gridview. I have the one-segment key in the select statement, in an invisible column of the gidview. I've set the DataKeyNames property to this column name (CinID).  The delete query reads - DELETE FROM CallIn WHERE (CinID = Cid) I've defined the parameter Cid as the Gridview.SelectedRow, .SelectedDataKey, .SelectedIndex, and .SelectedValue, all with no joy. I created SUB Gridview.RowCommand put a breakpoint there. e.Command shows "Delete" and e.CommandArgument shows the correct row index (1). I created SUB Girdview.DeletingRow and put a breakpoint there. debug shows .SelectedRow=nothing and .SelectedDataKey=nothing (but I don't know if they *should* show something, since I'm not selecting, but rather deleting the row. The postback occurs (click), the grid refreshes, but nothing happens. I cannot figure out why the clicked-on row does not delete. Any ideas?  

Replacing GridView Edit/Delete Buttons With Icons

Hello, is there a way to replace the autogenerated edit/delete buttons with icons instead of hyperlinks? Thanks

How to enable delete column at Gridview when having specify query.

Hello:  I have trouble to add delete column to gridview when using specific query. I have PK set up at the table, I need add specific query to display data at gridview:   SELECT [PID], [GID], [TID], [SID], [NEWSID] FROM [TableOne] WHERE ([NAME] = ?)   After builder this query, I click advanced button. However, generate insert, update, and delete Statements is not enabled.   How to add delete column to this gridview?   Your help is highly appreciated.

how to change gridview edit/delete name?

I have a gridview and in my code behind i have added the edit/update functions like below now how can i change the name of edit/delete which automatically comes ?  <asp:GridView ID="friendListGridview" runat="server" CellPadding="4"          ForeColor="#333333" GridLines="None"         AllowPaging="true" AutoGenerateColumns="false" Width="80%"  AutoGenerateEditButton="True" DataKeyNames="id"         AutoGenerateDeleteButton="True"     >        <Columns>          <asp:TemplateField                 ItemStyle-HorizontalAlign="Center" HeaderText="<%$ Resources:default, friendList %>"  >                <ItemTemplate>                    <%# Eval("ListName") %>             &nbs

Gridview control Delete error -- Must declare the scalar variable "@GradeID"

 Hi All,Pardon me if this seems redundant. I have searched the archives and found many references to this type of error. Most (all?) boil down to a mismatch between the token for the databound field and the sql parameter. I have stared at this code for a long time and can see nothing wrong with it. In fact, it is so simple that I started over from scratch using only the designer (ie I wrote no code), so I don't see how it possible to have a name mismatch. I would very much appreciate any help figuring out what is the problem here. Thank you very much in advance.-Roger   Server Error in '/ssp/inet220a06' Application. Must declare the scalar variable "@GradeID". Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Must declare the scalar variable "@GradeID". Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend