Confirm delete after Cancel in Datagrid/EditColumn (NOT ANSW ERED AND DRIVING ME NUTS)
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngescalate' list.


=?iso-8859-1?Q?Andr=E9_Colbi=F6rnsen?=

I have had no answers to this at aspngdatagridrepeaterdatalist after
many attempts (and it has not appeared in the Escalate list either in
spite of me sending it there several days ago)!!!!!!!!!! so I am trying
again to escalate. I suspect it has something to do with viewstate.

ORIGINAL PROBLEM:

"I'm having a problem finding a way to add onClick=3Dreturn confirm to a
button after having cancelled an update or updated. I have no problem
adding the attributes OnItemDataBound for item, alternating item and
edit item, but if I press the deletebutton after having updated the
record, the record is deleted without warning. Can anybody give me some
advice on this one?"

SCENARIO:

I have 3 datagrids in 1 web form 2 of the grids are hidden in an
invisible tablerow at pageload. When a button (orders) is clicked, the
first tablrow becomes invisible and the second visible. This tablerow
has 2 datagrids of which 1 is visible. If a linkbutton in this grid is
clicked, the third grid becomes visible. Now this is where my problems
arises. The datagrids are bound to 2 tables in a dataset "Products" and
"Orders". As I explain above, I have added the 'return confirm' to the
delete buttons in 2 of the datagrids on DataGrid_ItemDataBound, using:

"ListItemType.Item Or itemType =3D ListItemType.AlternatingItem Or
itemType =3D ListItemType.EditItem"

If I now try to delete an item I get the dialogue, as well as if I have
Edit activated. The rendered HTML looks like this:

'<input type=3D"submit" name=3D"dgrOrderDetails:_ctl2:btnDelOrder" =
value=3D"X"
id=3D"dgrOrderDetails__ctl2_btnDelOrder" class=3D"btnStoreAdmin"
onclick=3D"return confirm('Are you sure you want to delete this order:
180?');" />'

But after having clicked the cancel button (or the update button) the
rendered HTML now look like this:

'<input type=3D"submit" name=3D"dgrOrderDetails:_ctl2:btnDelOrder" =
value=3D"X"
id=3D"dgrOrderDetails__ctl2_btnDelOrder" class=3D"btnStoreAdmin" />'

The onclick event is not there anymore!! And yes I rebind the data to
the grid. Is there anybody out there who can shed some light on this?
It's driving me nuts!!! ;P I might add that I only have this this
problem with this page carrying 3 different grids. On a page with only
one datagrid everything is hunky dory.

I have since worked with a scenario which dynamically creates buttons
OnItemDataBound. What happens now is that the buttons disappear (or
rather are not created) when I press 'Cancel' or 'Update'. For some
reason, the data is not rebound to my grids on 'Cancel' and 'Update'
even though I'm calling DataBind() on both events.

Regards/H=E4lsningar

Andr=E9 Colbi=F6rnsen
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D
Sonnenburg Communications
Bergsgatan 3,
SE-211 54 Malm=F6
Sweden
Tel.: +46-(0)40-97 78 80
Fax.: +46-(0)40-97 78 80
Mob.: +46-(0)708-97 78 79
Mail: Click here to reveal e-mail address
Web.: www.sonnenburg.se
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D

Reply to this message...
 
    
Dennis West
Here is the only method I know of todate.

http://aspalliance.com/dotnetsolutions/GetSolution.aspx?ID=12795" target="_blank">http://aspalliance.com/dotnetsolutions/GetSolution.aspx?ID=12795

over 2500 ASP.NET solutions at http://aspalliance.com/dotnetsolutions

sign-up for daily updates

----- Original Message -----
From: "André Colbiörnsen" <Click here to reveal e-mail address>
To: "aspngescalate" <Click here to reveal e-mail address>
Sent: Tuesday, May 21, 2002 5:50 AM
Subject: [aspngescalate] Confirm delete after Cancel in Datagrid/EditColumn
(NOT ANSW ERED AND DRIVING ME NUTS)

I have had no answers to this at aspngdatagridrepeaterdatalist after
many attempts (and it has not appeared in the Escalate list either in
spite of me sending it there several days ago)!!!!!!!!!! so I am trying
again to escalate. I suspect it has something to do with viewstate.

ORIGINAL PROBLEM:

"I'm having a problem finding a way to add onClick=return confirm to a
button after having cancelled an update or updated. I have no problem
adding the attributes OnItemDataBound for item, alternating item and
edit item, but if I press the deletebutton after having updated the
record, the record is deleted without warning. Can anybody give me some
advice on this one?"

SCENARIO:

I have 3 datagrids in 1 web form 2 of the grids are hidden in an
invisible tablerow at pageload. When a button (orders) is clicked, the
first tablrow becomes invisible and the second visible. This tablerow
has 2 datagrids of which 1 is visible. If a linkbutton in this grid is
clicked, the third grid becomes visible. Now this is where my problems
arises. The datagrids are bound to 2 tables in a dataset "Products" and
"Orders". As I explain above, I have added the 'return confirm' to the
delete buttons in 2 of the datagrids on DataGrid_ItemDataBound, using:

"ListItemType.Item Or itemType = ListItemType.AlternatingItem Or
itemType = ListItemType.EditItem"

If I now try to delete an item I get the dialogue, as well as if I have
Edit activated. The rendered HTML looks like this:

'<input type="submit" name="dgrOrderDetails:_ctl2:btnDelOrder" value="X"
id="dgrOrderDetails__ctl2_btnDelOrder" class="btnStoreAdmin"
onclick="return confirm('Are you sure you want to delete this order:
180?');" />'

But after having clicked the cancel button (or the update button) the
rendered HTML now look like this:

'<input type="submit" name="dgrOrderDetails:_ctl2:btnDelOrder" value="X"
id="dgrOrderDetails__ctl2_btnDelOrder" class="btnStoreAdmin" />'

The onclick event is not there anymore!! And yes I rebind the data to
the grid. Is there anybody out there who can shed some light on this?
It's driving me nuts!!! ;P I might add that I only have this this
problem with this page carrying 3 different grids. On a page with only
one datagrid everything is hunky dory.

I have since worked with a scenario which dynamically creates buttons
OnItemDataBound. What happens now is that the buttons disappear (or
rather are not created) when I press 'Cancel' or 'Update'. For some
reason, the data is not rebound to my grids on 'Cancel' and 'Update'
even though I'm calling DataBind() on both events.

Regards/Hälsningar

André Colbiörnsen
================================
Sonnenburg Communications
Bergsgatan 3,
SE-211 54 Malmö
Sweden
Tel.: +46-(0)40-97 78 80
Fax.: +46-(0)40-97 78 80
Mob.: +46-(0)708-97 78 79
Mail: Click here to reveal e-mail address
Web.: www.sonnenburg.se
================================

| [aspngescalate] member Click here to reveal e-mail address = YOUR ID
| http://www.asplists.com/asplists/aspngescalate.asp = JOIN/QUIT

Reply to this message...
 
 
System.Web.UI.WebControls.DataGrid
System.Web.UI.WebControls.ListItemType
System.Windows.Forms.DataGrid




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com