Write an Article Write a Tutorial Add a Fast Code* *Fast Code might be any helpful code with brief comment
Stem Cells Blood Banks Insurances .Net Hosting Credit Cards PC Rental Business
Tutorials: ASP .NET C# .NET VB .NET Articles: ASP .NET C# .NET VB .NET Fast Code: ASP .NET C# .NET VB .NET
return confirm('your message here');
The user will be shown a confirm messagebox upon clicking the button (where msg is the string you want to appear in the confirm messagebox). If the user clicks the confirm messagebox's Cancel button the form will not be posted back; clicking the OK button will submit the form.
Unfortunately, the GridView's CommandField does not include an OnClientClick property. However, any Button in a GridView with a CommandName of Delete, when clicked, will cause the GridView to delete the associated record. Therefore we can create our own Delete button by adding a TemplateField that contains a Button (or LinkButton or ImageButton) with a CommandName of Delete. This added Button, then, can have an appropriate OnClientClick property value. Steps to add the Confirmation Code: 1. Open the Gridview code in the Page side. 2. Locate the Tag. 3. After the Tag Copy and Past this code:
:TemplateField> <ItemTemplate> <asp:LinkButtonID="LinkButton1"runat="server" OnClientClick="return confirm('Are you sure you want to delete this record?');" CommandName="Delete">Delete Commentasp:LinkButton> ItemTemplate> asp:TemplateField>
14/08/2007 04:43:47 UTC
24/10/2007 04:39:59 UTC
Can any one help.... without creating template field at design time how to display confirmation message
thanks in advance
25/10/2007 00:23:55 UTC
Either use Attributes.Add( ) method of a Control or Register the JavaScript from code behind. See this Article for more Explianation:
Add JavaScript to asp:Content block dynamically in ASP .NET 2.0
25/10/2007 00:52:02 UTC
Great Article
Very Helpful
THANKS
30/10/2007 21:40:26 UTC
Other way to do it
28/11/2007 00:17:26 UTC
02/01/2008 02:51:40 UTC
helped a little
04/01/2008 04:19:07 UTC
08/01/2008 18:32:53 UTC
i have gridview which has
Dim dgitem As GridViewRowDim lnkbtnremove As LinkButtonDim a As LabelFor Each dgitem In GridView1.Rows"lblinprodname")"lnkRemove")lnkbtnremove.Attributes.Add("onclick", "return confirm('Are you sure you want to Remove?')")Next
a = dgitem.FindControl(
lnkbtnremove = dgitem.FindControl(
on gridview1_rowcommand()
record is deleted
now i want product name with this "
lnkbtnremove.Attributes.Add("onclick", "return confirm('Are you sure you want to Remove bangjadtar?')")
"
plz help me how to do that..
in inline code
<
26/02/2008 05:15:59 UTC
10/03/2008 05:30:45 UTC
17/07/2008 20:40:06 UTC
18/07/2008 01:37:48 UTC
12/11/2008 01:20:53 UTC
12/11/2008 01:21:12 UTC