DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Mon, 13 Aug 2007 18:24:22 -0700,    posted on: microsoft.public.dotnet.framework.aspnet.datagridcontrol        back       

Thread Index
  1    Peter Afonin
          2    nahid
          3    nahid
          4    Peter Afonin
          5    Peter Afonin
          6    Peter Afonin
          7    Peter Afonin


Javascript confirmation message in datagrid   
Hello,

I need to add a confirmation message to the Delete button in the datagrid.

I was always using this code to do this:

Private Sub dgRoles_ItemCreated(ByVal sender As Object, ByVal e As 
System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgRoles.ItemCreated
'------------------------------------------------------------------------------------------------
' Display delete confirmation message
'------------------------------------------------------------------------------------------------
Try

Dim BtnDel As LinkButton

Select Case e.Item.ItemType

Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem

BtnDel = CType(e.Item.FindControl("lbDelete"), LinkButton)
BtnDel.Attributes.Add("onclick", "return confirm('Are you sure you want to 
remove this role?');")

End Select

Catch ex As Exception

Me.lblError.Text = "Error No.: " & Err.Number.ToString & " - " & ex.ToString

End Try

End Sub

I have used this code for years, so I know it works. But in my latest 
application I'm having some problems with it.

First, the message is not always displayed, and I cannot find any pattern 
when it's displayed and when it's not.

Second, even if the message is displayed correctly, no matter what button I 
click - OK or Cancel - the command is executed, and the deletion occurs.

Do you have any idea where the problem might be?

I would appreciate any suggestions.

Thank you,

Peter
Date:Mon, 13 Aug 2007 18:24:22 -0700   Author:  

Re: Javascript confirmation message in datagrid   
On Aug 14, 7:24 am, "Peter Afonin"  wrote:

> Hello,
>
> I need to add a confirmation message to the Delete button in the datagrid.
>
> I was always using this code to do this:
>
> Private Sub dgRoles_ItemCreated(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgRoles.ItemCreated
> '--------------------------------------------------------------------------­----------------------
> ' Display delete confirmation message
> '--------------------------------------------------------------------------­----------------------
> Try
>
> Dim BtnDel As LinkButton
>
> Select Case e.Item.ItemType
>
> Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
>
> BtnDel = CType(e.Item.FindControl("lbDelete"), LinkButton)
> BtnDel.Attributes.Add("onclick", "return confirm('Are you sure you want to
> remove this role?');")
>
> End Select
>
> Catch ex As Exception
>
> Me.lblError.Text = "Error No.: " & Err.Number.ToString & " - " & ex.ToString
>
> End Try
>
> End Sub
>
> I have used this code for years, so I know it works. But in my latest
> application I'm having some problems with it.
>
> First, the message is not always displayed, and I cannot find any pattern
> when it's displayed and when it's not.
>
> Second, even if the message is displayed correctly, no matter what button I
> click - OK or Cancel - the command is executed, and the deletion occurs.
>
> Do you have any idea where the problem might be?
>
> I would appreciate any suggestions.
>
> Thank you,
>
> Peter


hi,
see this hope help
http://nahidulkibria.blogspot.com/2007/05/javascript-confirm-using-at.html

thanks
nahid
Date:Mon, 13 Aug 2007 21:42:17 -0700   Author:  

Re: Javascript confirmation message in datagrid   
On Aug 14, 7:24 am, "Peter Afonin"  wrote:

> Hello,
>
> I need to add a confirmation message to the Delete button in the datagrid.
>
> I was always using this code to do this:
>
> Private Sub dgRoles_ItemCreated(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgRoles.ItemCreated
> '--------------------------------------------------------------------------­----------------------
> ' Display delete confirmation message
> '--------------------------------------------------------------------------­----------------------
> Try
>
> Dim BtnDel As LinkButton
>
> Select Case e.Item.ItemType
>
> Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
>
> BtnDel = CType(e.Item.FindControl("lbDelete"), LinkButton)
> BtnDel.Attributes.Add("onclick", "return confirm('Are you sure you want to
> remove this role?');")
>
> End Select
>
> Catch ex As Exception
>
> Me.lblError.Text = "Error No.: " & Err.Number.ToString & " - " & ex.ToString
>
> End Try
>
> End Sub
>
> I have used this code for years, so I know it works. But in my latest
> application I'm having some problems with it.
>
> First, the message is not always displayed, and I cannot find any pattern
> when it's displayed and when it's not.
>
> Second, even if the message is displayed correctly, no matter what button I
> click - OK or Cancel - the command is executed, and the deletion occurs.
>
> Do you have any idea where the problem might be?
>
> I would appreciate any suggestions.
>
> Thank you,
>
> Peter


hi,
see this hope help
http://nahidulkibria.blogspot.com/2007/05/javascript-confirm-using-at.html

thanks
nahid
Date:Mon, 13 Aug 2007 21:42:17 -0700   Author:  

Re: Javascript confirmation message in datagrid   
Thank you, Nahid.

But this is almost exactly what I use. Only you use gridview with ASP.NET 
2.0, and I'm using Datagrid with 1.1.

-- 
Peter Afonin


"nahid" wrote:


> On Aug 14, 7:24 am, "Peter Afonin"  wrote:
> > Hello,
> >
> > I need to add a confirmation message to the Delete button in the datagrid.
> >
> > I was always using this code to do this:
> >
> > Private Sub dgRoles_ItemCreated(ByVal sender As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgRoles.ItemCreated
> > '-------------------------------------------------------------------------------------------------
> > ' Display delete confirmation message
> > '-------------------------------------------------------------------------------------------------
> > Try
> >
> > Dim BtnDel As LinkButton
> >
> > Select Case e.Item.ItemType
> >
> > Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
> >
> > BtnDel = CType(e.Item.FindControl("lbDelete"), LinkButton)
> > BtnDel.Attributes.Add("onclick", "return confirm('Are you sure you want to
> > remove this role?');")
> >
> > End Select
> >
> > Catch ex As Exception
> >
> > Me.lblError.Text = "Error No.: " & Err.Number.ToString & " - " & ex.ToString
> >
> > End Try
> >
> > End Sub
> >
> > I have used this code for years, so I know it works. But in my latest
> > application I'm having some problems with it.
> >
> > First, the message is not always displayed, and I cannot find any pattern
> > when it's displayed and when it's not.
> >
> > Second, even if the message is displayed correctly, no matter what button I
> > click - OK or Cancel - the command is executed, and the deletion occurs.
> >
> > Do you have any idea where the problem might be?
> >
> > I would appreciate any suggestions.
> >
> > Thank you,
> >
> > Peter
> 
> hi,
> see this hope help
> http://nahidulkibria.blogspot.com/2007/05/javascript-confirm-using-at.html
> 
> thanks
> nahid
> 
> 
Date:Tue, 14 Aug 2007 10:26:01 -0700   Author:  

Re: Javascript confirmation message in datagrid   
Thank you, Nahid.

But this is almost exactly what I use. Only you use gridview with ASP.NET 
2.0, and I'm using Datagrid with 1.1.

-- 
Peter Afonin


"nahid" wrote:


> On Aug 14, 7:24 am, "Peter Afonin"  wrote:
> > Hello,
> >
> > I need to add a confirmation message to the Delete button in the datagrid.
> >
> > I was always using this code to do this:
> >
> > Private Sub dgRoles_ItemCreated(ByVal sender As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgRoles.ItemCreated
> > '-------------------------------------------------------------------------------------------------
> > ' Display delete confirmation message
> > '-------------------------------------------------------------------------------------------------
> > Try
> >
> > Dim BtnDel As LinkButton
> >
> > Select Case e.Item.ItemType
> >
> > Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
> >
> > BtnDel = CType(e.Item.FindControl("lbDelete"), LinkButton)
> > BtnDel.Attributes.Add("onclick", "return confirm('Are you sure you want to
> > remove this role?');")
> >
> > End Select
> >
> > Catch ex As Exception
> >
> > Me.lblError.Text = "Error No.: " & Err.Number.ToString & " - " & ex.ToString
> >
> > End Try
> >
> > End Sub
> >
> > I have used this code for years, so I know it works. But in my latest
> > application I'm having some problems with it.
> >
> > First, the message is not always displayed, and I cannot find any pattern
> > when it's displayed and when it's not.
> >
> > Second, even if the message is displayed correctly, no matter what button I
> > click - OK or Cancel - the command is executed, and the deletion occurs.
> >
> > Do you have any idea where the problem might be?
> >
> > I would appreciate any suggestions.
> >
> > Thank you,
> >
> > Peter
> 
> hi,
> see this hope help
> http://nahidulkibria.blogspot.com/2007/05/javascript-confirm-using-at.html
> 
> thanks
> nahid
> 
> 
Date:Tue, 14 Aug 2007 10:26:01 -0700   Author:  

Re: Javascript confirmation message in datagrid   
I understand now why the message box wasn't always there, so this has been 
taken care of, but I still cannot understand why the delete command is always 
executed, no matter what button I press.

Thanks,

Peter
-- 
Peter Afonin


"nahid" wrote:


> On Aug 14, 7:24 am, "Peter Afonin"  wrote:
> > Hello,
> >
> > I need to add a confirmation message to the Delete button in the datagrid.
> >
> > I was always using this code to do this:
> >
> > Private Sub dgRoles_ItemCreated(ByVal sender As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgRoles.ItemCreated
> > '-------------------------------------------------------------------------------------------------
> > ' Display delete confirmation message
> > '-------------------------------------------------------------------------------------------------
> > Try
> >
> > Dim BtnDel As LinkButton
> >
> > Select Case e.Item.ItemType
> >
> > Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
> >
> > BtnDel = CType(e.Item.FindControl("lbDelete"), LinkButton)
> > BtnDel.Attributes.Add("onclick", "return confirm('Are you sure you want to
> > remove this role?');")
> >
> > End Select
> >
> > Catch ex As Exception
> >
> > Me.lblError.Text = "Error No.: " & Err.Number.ToString & " - " & ex.ToString
> >
> > End Try
> >
> > End Sub
> >
> > I have used this code for years, so I know it works. But in my latest
> > application I'm having some problems with it.
> >
> > First, the message is not always displayed, and I cannot find any pattern
> > when it's displayed and when it's not.
> >
> > Second, even if the message is displayed correctly, no matter what button I
> > click - OK or Cancel - the command is executed, and the deletion occurs.
> >
> > Do you have any idea where the problem might be?
> >
> > I would appreciate any suggestions.
> >
> > Thank you,
> >
> > Peter
> 
> hi,
> see this hope help
> http://nahidulkibria.blogspot.com/2007/05/javascript-confirm-using-at.html
> 
> thanks
> nahid
> 
> 
Date:Wed, 15 Aug 2007 13:38:05 -0700   Author:  

Re: Javascript confirmation message in datagrid   
I understand now why the message box wasn't always there, so this has been 
taken care of, but I still cannot understand why the delete command is always 
executed, no matter what button I press.

Thanks,

Peter
-- 
Peter Afonin


"nahid" wrote:


> On Aug 14, 7:24 am, "Peter Afonin"  wrote:
> > Hello,
> >
> > I need to add a confirmation message to the Delete button in the datagrid.
> >
> > I was always using this code to do this:
> >
> > Private Sub dgRoles_ItemCreated(ByVal sender As Object, ByVal e As
> > System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgRoles.ItemCreated
> > '-------------------------------------------------------------------------------------------------
> > ' Display delete confirmation message
> > '-------------------------------------------------------------------------------------------------
> > Try
> >
> > Dim BtnDel As LinkButton
> >
> > Select Case e.Item.ItemType
> >
> > Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem
> >
> > BtnDel = CType(e.Item.FindControl("lbDelete"), LinkButton)
> > BtnDel.Attributes.Add("onclick", "return confirm('Are you sure you want to
> > remove this role?');")
> >
> > End Select
> >
> > Catch ex As Exception
> >
> > Me.lblError.Text = "Error No.: " & Err.Number.ToString & " - " & ex.ToString
> >
> > End Try
> >
> > End Sub
> >
> > I have used this code for years, so I know it works. But in my latest
> > application I'm having some problems with it.
> >
> > First, the message is not always displayed, and I cannot find any pattern
> > when it's displayed and when it's not.
> >
> > Second, even if the message is displayed correctly, no matter what button I
> > click - OK or Cancel - the command is executed, and the deletion occurs.
> >
> > Do you have any idea where the problem might be?
> >
> > I would appreciate any suggestions.
> >
> > Thank you,
> >
> > Peter
> 
> hi,
> see this hope help
> http://nahidulkibria.blogspot.com/2007/05/javascript-confirm-using-at.html
> 
> thanks
> nahid
> 
> 
Date:Wed, 15 Aug 2007 13:38:05 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us