Wrox Programmer Forums
|
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
 
Old December 12th, 2005, 11:15 PM
Authorized User
 
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to raybristol
Default 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

 
Old December 13th, 2005, 01:54 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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

 
Old December 13th, 2005, 02:03 AM
Authorized User
 
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to raybristol
Default

thanks for your reply, is there any solutions?

 
Old December 13th, 2005, 02:07 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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.

 
Old December 14th, 2005, 01:16 PM
Authorized User
 
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to raybristol
Default

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!

 
Old December 14th, 2005, 03:21 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Is this a windows app or a web app? This forum is for asp.net apps.

 
Old December 14th, 2005, 04:12 PM
Authorized User
 
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to raybristol
Default

oh, it's web form, i was just thinking is that gonna be similar?

 
Old December 15th, 2005, 12:34 AM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

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.

 
Old December 15th, 2005, 06:46 AM
Authorized User
 
Join Date: Dec 2005
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to raybristol
Default

thanks very much! i will try that.






Similar Threads
Thread Thread Starter Forum Replies Last Post
strange IE problem sully7 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 September 19th, 2008 08:44 AM
Strange problem... F3553 C++ Programming 1 October 25th, 2007 03:56 PM
Strange ListBox Problem mirandaym ASP.NET 2.0 Basics 1 August 2nd, 2006 05:00 AM
strange problem with ASP dhx10000 BOOK: Beginning ASP 3.0 0 June 12th, 2006 05:10 PM
kind of Really strange problem kalchev ASP.NET 2.0 Basics 1 March 22nd, 2006 03:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.