Results 1 to 6 of 6

Thread: Version 1/20 ApplyDelete problem

  1. #1
    Join Date
    Oct 2002
    Posts
    161

    Version 1/20 ApplyDelete problem

    The condition than generates the "applydelete" last click is not right.
    Hitting the delete button without selecting any items should not generate the "applydelete" last click, "applydelete" should only be generated when there are marked items and the delete botton is hit.
    Currently you do not have to delete any records to generate the "applydelete". If no items are selected, hiting the delete button repeatedly should always generate a "delete" last click.

  2. #2
    Join Date
    Oct 2002
    Posts
    933
    'applydelete' and other buttons conditions are generated to declare the button hit state and nothing else. To detect whether there is any 'selected items' checked for deletion, you can check it many ways.


    FK

  3. #3
    Join Date
    Oct 2002
    Posts
    161
    If that's the case, then delete and applydelete mean exactly the same thing, all it tells me is that the delete button has been pressed.
    You cannot tell any difference between the user actualy deleting records or hitting the delete button by mistake and then correcting their mistake by hitting the delete button again. You cannot make any determination of what they did by the button state.

    The applyadd is different because it is generated by the Go button which does add a record and if they change their mind they can hit the cancel button which does not generate the "applyadd", since the only way to cancel a delete is to not select anything and hit delete again, it makes it imposssible to use the applydelete lastclick to make any sort of determination. I need to know if the master record has been deleted in order to delete all detail records and not leave any orphans behind.

    If it is to be that way, can you give me an example on how to check for marked deleted items?

  4. #4
    Join Date
    Oct 2002
    Posts
    933
    this is actually a selecteditem exercise like example #22. Try the following ->

    <script language="VB" runat="server">
    Sub Page_Load(Src As Object, E As EventArgs)
    Dim GD As New Tornado.Getdata()
    Dim X As New Tornado.Z()
    If GD.Get_LastClick = "applydelete" Then
    Dim a() As String = X.dbSelectedItem()
    Dim res As String = "Items selected for deletion - <br>", i As Integer
    If Not IsNothing(a) Then
    For i = 0 To UBound(a) : res &= a(i) & "<br>" : Next i
    Else
    res &= "None"
    End If
    Response.Write(res)
    Exit Sub
    End If
    With X
    .dbQP = "u=77|s=12|d=nwind.mdb|bm=orders;0|ni=b5,delete|Q= select * from orders| gdf=0,1,2,3"
    .ASPdbNET()
    End With
    End Sub
    </script>

  5. #5
    Join Date
    Oct 2002
    Posts
    161
    Your code works good in a simple one table grid, unfortunitely I need to make it work in a more complex setup, I display more than one grid per screen, I just added another grid at the end of your code, and it no longer records the selected items and always return "none" for items selected, would you know how to modify this to make it work.

    <script language="VB" runat="server">
    Sub Page_Load(Src As Object, E As EventArgs)
    Dim GD As New Tornado.Getdata()
    Dim X As New Tornado.Z()
    If GD.Get_LastClick = "applydelete" Then
    Dim a() As String = X.dbSelectedItem()
    Dim res As String = "Items selected for deletion - <br>", i As Integer
    If Not IsNothing(a) Then
    For i = 0 To UBound(a) : res &= a(i) & "<br>" : Next i
    Else
    res & = "None"
    End If
    Response.Write(res)
    'Exit Sub
    End If

    With X
    .dbQP = "u=77|s=12|d=nwind.mdb|bm=orders;0|ni=b5,delete|Q= select * from orders| gdf=0,1,2,3"
    .ASPdbNET()
    End With

    Dim z As New Tornado.Z()

    With z
    .dbQP = "u=78|s=12|d=nwind.mdb|bm=customers;0|ni=b5,delete |Q=select * from orders| gdf=0,1,2,3"
    .ASPdbNET()
    End With

    End Sub
    </script>

  6. #6
    Join Date
    Oct 2002
    Posts
    933
    there has been quite a few meesages in multi-modules programming. Overall, it does not look right to have multiple edit screens. The way to do it is to make a combo screen and use multiple SQLs to edit multiple tables at the same time. Multi-modules takes resources to 'remember' the states. Since only one module can be active at a time, you should detect the unit in action at the top and then retrieve the module's data like stiems accordingly.

    FK

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •