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

Delete Confirmation


Hello All,

In my GridView, I am using "BoundFiled" for "Delete" functionality instead of "ItemTemplate".

Now, I want a "Delete Confirmation" with Javascript.

What I have to do.

Regards,

Ajmal
Aug 29 '08 #1
1 1433
"AJMAL YAZDANI" wrote in message news:20****************@istsinc.com...
In my GridView, I am using "BoundFiled" for "Delete" functionality instead
of "ItemTemplate".

Now, I want a "Delete Confirmation" with Javascript.

What I have to do.
In the ItemDataBound event, add the javascript code to your boundfield:

private void myGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
string script = "javascript:return confirm('Are you sure?')";

if (e.Item.ItemType!=ListItemType.Header &&
e.Item.ItemType!=ListItemType.Footer)
{
ImageButton imgButton = (ImageButton)e.Item.Cells[0].Controls[1];
if (imgButton.CommandName == "Delete")
{
imgButton.Attributes["onclick"] = script;
}
}
}

Obviously, in the preceding code, you will have to replace the
Cells[0].Controls[1] with the location of your actual control, and if it is
not an ImageButton you will also have to change the type also.

Aug 29 '08 #2

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

Similar topics

4
by: Mike Brearley | last post by:
How would I add a delete confirmation popup box for the following? Here's what I have... A table (not a form) that contains this line: <td align="center"><a...
3
by: Asif Rahman | last post by:
Hi all! Please improve on the following code to make sure the record gets deleted only when the function returns false. Now I see the msgbox, but the record gets deleted no matter the user...
0
by: Bas V. | last post by:
I am using Visual Studio Express 2005 beta 1, C#. I use the UserDeletingRow event to show a confirmation messagebox when a user tries to delete a record from a DataGrid. When the user presses the...
6
by: Dotnet Guy | last post by:
I want to add a confirmation dialog box before I delete the records in my form. I have a piece of javascript code in html that checks for confirmation. But the main issue lies in calling this...
0
by: Nedu N | last post by:
Hi Experts, All of sudden the delete confirmation is not working for me on my datagrid (it was working 2 days ago..couldn't figure out the cause). I am trying to add an 'onsubmit' attribute to...
3
by: Dave | last post by:
How can I add the confirmation dialog on record delete to the "Delete" command column in DataGrid control?
4
by: DrData | last post by:
I'm working on an ASP.Net application written in C#. On one page, there are several datagrid controls used to display, edit and delete detail records relating to the master record also displayed on...
0
by: johnmott | last post by:
Hi all, One of the limitations of the GridView control is that the built-in delete processing doesn't prompt for confirmation -- something thats very important for a user interface. True, you...
1
vivek kushwaha
by: vivek kushwaha | last post by:
Hi, i have codes like this. code behind page Private Sub DataGrid1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles...
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
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...

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.