 |
| ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

December 12th, 2005, 11:15 PM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
very strange problem! please help!
hi, i post this question before, but maybe not clear, so here we goes:
in my datagrid, i have a delete button to delete multiple rows(every row is got a checkbox). i need to put a confirm window before actually delete those selected items, the window is popup, however, there is a for loop for searching selected item's title (so user can see clearly what items will be deleted) is not running! i dun know why, the for loop is there! but it seems be skiped when running so i couldn't get selected item's title, anyone knows why? many thanks!
'add confirmation window on delete button
Private Sub DataGrid1_ItemGreated(ByVal Sender As Object, ByVal e As DataGridItemEventArgs) Handles DataGrid1.ItemCreated
Dim delIDs As String = ""
' this for loop is not actually running?
For Each i As DataGridItem In DataGrid1.Items
Dim deleteChkBxItem As CheckBox = CType(i.FindControl("DeleteThis"), CheckBox)
If deleteChkBxItem.Checked Then
delIDs += CType(i.FindControl("Hyperlink8"), HyperLink).Text.ToString + ","
End If
Next
Select Case e.Item.ItemType
Case ListItemType.Item, ListItemType.AlternatingItem, ListItemType.EditItem, ListItemType.Header
Dim myDeleteButton As WebControl
myDeleteButton = e.Item.FindControl("delConfirm")
If myDeleteButton Is Nothing Then
Else
myDeleteButton.Attributes.Add("onClick", "return confirm('Are you sure you want to delete the following News? " + delIDs + " ');")
End If
End Select
chkState()
End Sub
|
|

December 13th, 2005, 01:54 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
First: The loop is running. But since you put it in the itemcreated event, it will only run once, once for each grid item created.
Second: You would need the server side loop code to run before the client side confirm. This cannot happen since the client side code will fire first.
Jim
|
|

December 13th, 2005, 02:03 AM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks for your reply, is there any solutions?
|
|

December 13th, 2005, 02:07 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
I guess you could gather the info, and instead of using a popup, pass it to another page. There you can ask if they want to delete or not. If so, delete as needed and redirect to some page, otherwise redirect to the previous page.
|
|

December 14th, 2005, 01:16 PM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
you mean to use another page as the popup window?as in winform application, a popup windows is actually another winform.
many thanks for your help!
|
|

December 14th, 2005, 03:21 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
Is this a windows app or a web app? This forum is for asp.net apps.
|
|

December 14th, 2005, 04:12 PM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
oh, it's web form, i was just thinking is that gonna be similar?
|
|

December 15th, 2005, 12:34 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
|
|
A pop up window in a web app is is a web page. However, like I said, you can't execute the server side code before the client side code. So, I suggested you just redirect to another web page.
|
|

December 15th, 2005, 06:46 AM
|
|
Authorized User
|
|
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
thanks very much! i will try that.
|
|
 |