locked
Webform that makes calls to other windows step by step as part of a process RRS feed

  • Question

  • User-1300128566 posted

    Good day to all

    I have a process that starts in a webform and goes calling some data confirmation windows as the process progresses.

    It is a web application, so in the process button I can not place the continuous calls, since I would only call the first, and the others ignore them.

    For this case I am using a timer, which runs every 5 seconds and validates in addition to other features of the page, which has pressed the process button, and has opened the previous page, considering the process.

    Now, the timer made me postback on the whole page every time it was executed, for what I have considered, an updatepanel to control what I want to refresh and not. The windows worked perfectly when everything was refreshed, but now I do not open the windows of the process. I imagine I have them in a section where they should not be, I have tried to place them inside or outside the updatepanel, I have tried calling them from javascript with a function, and pass parameters to the scriptmanager, I have tried to place the function as a script inside the scriptmanager, but nothing has worked for me. I do not know what else to do.

    Thanks for your comments and ideas

    Best regards

    Tuesday, June 18, 2019 2:20 PM

All replies

  • User-1300128566 posted

    My aspx:

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="neworder.aspx.vb" Inherits="ITWExtranet.WebForm1" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>ITW Welding Products Group - Nueva Orden</title>
        <link href="stylesneword.css" rel="stylesheet" />
        <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
        <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
        <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" />
    
    </head>
    <body>
    
        <form id="formneworder" runat="server">
        <section id="headerform">
            <div id="logoitw"><img class="logoitw" src="images/itw-logo.png" /></div> 
        </section>
        <section id="tittleitwsct" class="tittleitwsct">
            <asp:TextBox ID="tittleitw" runat="server" CssClass="tittleitw"></asp:TextBox>
        </section> 
        <section id="buttonsection">
            <div id="buttons" class="buttons">
                <asp:Button ID="BNewOrder" CssClass="BNewOrder" runat="server" Text="Nueva Orden" />
                <asp:Button ID="BSearchOrder" CssClass="BSearchOrder" runat="server" Text="Consultar Orden" />
                <asp:Button ID="BCatal" CssClass="BCatal" runat="server" Text="Catálogo" />
                <asp:Button ID="BSearchInv" CssClass="BSearchInv" runat="server" Text="Consultar Factura" />
                <asp:Button ID="ButtExit" CssClass="ButtExit" runat="server" Text="Salir" />
            </div>
        </section>
        <section id="tittleform" class="tittleform">Nueva Orden</section>
        <section id="ordersection">
            <div id="general" class="generaldata">
                <section class="fieldCustomer">
                    <asp:Label ID="lCustomer" runat="server" Text="Cliente"></asp:Label>
                    <asp:TextBox ID="tCustomer" runat="server" Enabled="false" Width="500"></asp:TextBox>
                    <asp:HiddenField ID="HFCuryID" runat="server" />
                </section>
                <section class="fieldCustomerID">
                    <asp:Label ID="lCustomerID" runat="server" Text="ID Cliente"></asp:Label>
                    <asp:TextBox ID="tCustomerID" runat="server" Enabled="false"></asp:TextBox>
                </section>
                <section class="fieldIncoterm">
                    <asp:Label ID="lIncoterm" runat="server" Text="Incoterm"></asp:Label>
                    <asp:TextBox ID="tIncoterm" runat="server" Enabled="false"></asp:TextBox>
                    <asp:HiddenField ID="HFAddress" runat="server" />
                    <asp:HiddenField ID="HFSHipVia" runat="server" />
                </section>
                <section class="fieldOC">
                    <asp:Label ID="lOC" runat="server" Text="O.C. Cliente"></asp:Label>
                    <asp:TextBox ID="tOC" runat="server"></asp:TextBox>
                </section>
                <section class="fieldPartNbr">
                    <asp:Label ID="lPartNbr" runat="server" Text="Número de Parte"></asp:Label>
                    <asp:TextBox ID="tPartNbr" runat="server"></asp:TextBox>
                </section>
                <section class="fieldDescript">
                    <asp:Label ID="lDescript" runat="server" Text="Descripción"></asp:Label>
                    <asp:TextBox ID="tDescript" runat="server" Width="500" Enabled="false"></asp:TextBox>
                </section>
                <section id="hiddenFieldsForGrid">
                    <asp:HiddenField ID="HFSegmento" runat="server" />
                    <asp:HiddenField ID="HFStock" runat="server" />
                    <asp:HiddenField ID="HFPresent" runat="server" />
                    <asp:HiddenField ID="HFQtyAval" runat="server" />
                    <asp:HiddenField ID="HFLeadTime" runat="server" />
                    <asp:HiddenField ID="HFStatus" runat="server" />
                    <asp:HiddenField ID="HFSubstitute" runat="server" />
                    <asp:HiddenField ID="HFPack" runat="server" />
                </section>
                <section class="fieldSegment">
                    <asp:Label ID="lSegment" runat="server" Text="Segmento"></asp:Label>
                    <asp:DropDownList ID="DDLSegment" runat="server" DataSourceID="XmlSegment" DataTextField="type" DataValueField="id"></asp:DropDownList>
                    <asp:XmlDataSource ID="XmlSegment" runat="server" DataFile="~/listSegment.xml"></asp:XmlDataSource>
                </section>
                <section class="fieldQty">
                    <asp:Label ID="lQty" runat="server" Text="Cantidad"></asp:Label>
                    <asp:TextBox ID="tQty" runat="server" Width="50"></asp:TextBox>
                    <img id="shopCart" class="shopCart" src="images/carrito-compras.png" />
                    <asp:Button ID="bAdd" CssClass="bAdd" runat="server" Text="Agregar" />
                </section>
    
            </div>
        </section>
        <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>
            <section class="details">
                <section class="grDetails">
                    <asp:GridView ID="gridProducts" runat="server" EmptyDataText="Sin Productos Agregados" 
                        Height="143px" Width="433px" AutoGenerateColumns="false">
                        <Columns>
                            
                            <asp:TemplateField HeaderText="√">
                                <ItemTemplate><asp:CheckBox ID="ProductSelector" runat="server" /></ItemTemplate> 
                            </asp:TemplateField>
                            <asp:BoundField HeaderText="No Parte" DataField="pPartNbr" />
                            <asp:BoundField HeaderText="Descripción" DataField="pDescrip" />
                            <asp:BoundField HeaderText="Segmento" DataField="pSegmento" />
                            <asp:BoundField HeaderText="Stock" DataField="pStock" />
                            <asp:BoundField HeaderText="Presentación" DataField="pQtyMin" />
                            <asp:BoundField HeaderText="Cantidad ordenada" DataField="pQtyOrd" />
                            <asp:BoundField HeaderText="Cantidad disponible" DataField="pQtyAval" />
                            <asp:BoundField HeaderText="Lead Time" DataField="pLeadTime" />
                            <asp:BoundField HeaderText="Precio Unitario" DataField="pPriceUnit" ItemStyle-HorizontalAlign="Right" />
                            <asp:BoundField HeaderText="Precio Extendido" DataField="pPriceExtend" ItemStyle-HorizontalAlign="Right" />
    
                        </Columns>
                        <EmptyDataRowStyle BorderColor="Black" BorderStyle="Solid" />
                    </asp:GridView>
                </section>
                <section class="fieldOrderTotal">
                    <asp:Label ID="lOrdTotal" runat="server" Text="Total:"></asp:Label>
                    <asp:TextBox ID="tOrdTotal" runat="server" Enabled="false" CssClass="tOrdTotal" ></asp:TextBox>
                </section>
            </section>
            <asp:Timer ID="Timer3" runat="server" Interval="5000" Enabled="true" OnTick="Timer3_Tick">
            </asp:Timer>
            <section id="marquee" class="marquee">
                <asp:Label ID="marqueeText" runat="server" Text="Esta es la marquesina"></asp:Label>
            </section>
    
        </ContentTemplate></asp:UpdatePanel>
                <section class="buttGrid">
                    <asp:Button ID="bDelete" CssClass="bDelete" runat="server" Text="Eliminar" />
                    <asp:Button ID="bNext" CssClass="bNext" runat="server" Text="Siguiente" />
                </section>
            <section id="footform">
                <img id="lgMiller" class="lgMiller" src="images/Logo-miller.png" />
                <img id="lgHobart" class="lgHobart" src="images/Hobart-Logo.jpg" />
                <img id="lgTregas" class="lgTregas" src="images/logo-tregaskiss.png" />
                <img id="lgBernard" class="lgBernard" src="images/bernard-logo.jpg" />
            </section>
       
            <section id="linksbottom" class="linksbottom">
                <asp:HyperLink ID="hlPrivacy" runat="server" NavigateUrl="~/contracts/Privacidad.pdf" Target="_blank">Aviso de Privacidad</asp:HyperLink> | <asp:HyperLink ID="hlContacts" runat="server" NavigateUrl="~/contracts/Contactos.pdf" Target="_blank">Contacto</asp:HyperLink> | &copy;2018 ITW Inc. Todos los derechos reservados
            </section>
        <asp:DropDownList ID="DDLMarquee" runat="server" Visible="false" AppendDataBoundItems="true"></asp:DropDownList>
        
        </form>
    </body>
    </html>
    

    My aspx.vb

        Protected Sub bNext_Click(sender As Object, e As EventArgs) Handles bNext.Click
            ' Validar que campos deben estar llenos
            Dim vOrdTotal As Double = CDbl(tOrdTotal.Text)
            If tOC.Text = "" Then
                winBox("Alerta", "Se debe indicar el numero de Orden")
                SetFocus(tOC)
            Else
                If vOrdTotal > 0 Then
    
                    Session("ProccessOK") = False
    
                    ' Validar que el monto sea mayor o igual al minimo por orden de acuerdo a la moneda
                    Dim stringConnection = ConfigurationManager.ConnectionStrings("MyConnection").ConnectionString
                    Dim cn As New SqlConnection(stringConnection)
    
                    Dim params(0) As SqlParameter
                    params(0) = New SqlParameter("@Curyid", SqlDbType.VarChar)
                    params(0).Value = HFCuryID.Value
    
                    Dim vDataMntMin As New SqlCommand("sp_xSlsPortalGetAmtMin", cn)
                    vDataMntMin.CommandType = CommandType.StoredProcedure
                    vDataMntMin.Parameters.AddRange(params)
    
                    Dim drDataMntMin As SqlDataReader
                    cn.Open()
                    drDataMntMin = vDataMntMin.ExecuteReader
    
                    Dim vMntMin As Double
    
                    Session("procContinue") = "True"
    
                    While drDataMntMin.Read
    
                        vMntMin = drDataMntMin(0)  'MntMin
    
                        ' Business Rules
                        If tOrdTotal.Text < vMntMin Then
    
                            Session("CtrlMntMin") = vMntMin.ToString("F")
                            Session("CtrlCuryID") = HFCuryID.Value
    
                            Try
                                ventanas.abreVentana(Me, "winMtoMin.aspx", 400, 200, 483, 284)
                            Catch ex As Exception
                                ventanas.atrapaError(Me, ex.Message)
                            End Try
    
                            Session("procContinue") = "False"
    
                        End If
    
                    End While
    
                    drDataMntMin.Close()
                    cn.Close()
    
                    If CType(Session.Item("procContinue"), String) = "True" Then
    
                        ' Seleccionar la forma de surtimiento
                        Try
                            ventanas.abreVentana(Me, "winSurtMode.aspx", 400, 200, 483, 284)
                        Catch ex As Exception
                            ventanas.atrapaError(Me, ex.Message)
                        End Try
    
                    End If
    
                Else
                    winBox("Alerta", "Esta Orden que esta intentando agregar esta vacía")
                End If
    
            End If
    
        End Sub
    
        Protected Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
    
            Dim vcontador As Integer = CType(Session.Item("confTimerCount"), Integer)
    
            '' Cerrar por timeout
            If vcontador > 0 Then
                Session("confTimerCount") = vcontador - 1
            Else
                'Exit by timeout
                Session("Profile") = ""
                Response.Redirect("windowsclose.aspx")
            End If
    
            '' Marquesina de Mensajes
            Dim vlenMarquee As Integer = CType(Session.Item("confLenMarquee"), Integer)
            Dim vnroMsgMarquee As Integer = CType(Session.Item("confNroMsgMarquee"), Integer)
            If vlenMarquee > 0 Then
                If vnroMsgMarquee > vlenMarquee - 1 Then   'confNroMsgMarquee
                    Session("confNroMsgMarquee") = 0
                    vnroMsgMarquee = 0
                End If
                marqueeText.Text = DDLMarquee.Items.Item(vnroMsgMarquee).Value
                Session("confNroMsgMarquee") = vnroMsgMarquee + 1
            End If
    
            '' Ventanas de completar datos de la Orden
            Dim vEditYesNo As String = CType(Session.Item("EditYesNo"), String)
    
            If vEditYesNo = "Cancelar" Then
                SetInitialRow()
                vEditYesNo = ""
                Session("EditYesNo") = ""
                SetFocus(tPartNbr)
            End If
    
            Dim vSurtMode As String = CType(Session.Item("SurtMode"), String)
            Dim vprocFactOK As String = CType(Session.Item("procFactOK"), String)
            Dim vProccessOK As Boolean = CType(Session.Item("ProccessOK"), Boolean)
            Dim vFactMen As String = CType(Session.Item("FactMen"), String)
    
            If vSurtMode <> "" And vFactMen = "" And Not vProccessOK Then
                ' Ventana de aceptar facturas por importes menores
                vprocFactOK = "True"
    
                Try
                    ventanas.abreVentana(Me, "winFactImpMen.aspx", 400, 200, 483, 284)
                Catch ex As Exception
                    ventanas.atrapaError(Me, ex.Message)
                End Try
    
            End If
    
            Dim vprocAddress As String = CType(Session.Item("procAddress"), String)
            Dim vAddressC As String = CType(Session.Item("AddressC"), String)
            vProccessOK = CType(Session.Item("ProccessOK"), Boolean)
    
            If vFactMen <> "" And vprocAddress = "False" And Not vProccessOK And vAddressC = "" Then
                ' Ventana de cambio de direccion 
                vprocAddress = "True"
                Try
                    ventanas.abreVentana(Me, "winChangeAdd.aspx", 400, 200, 483, 284)
                Catch ex As Exception
                    ventanas.atrapaError(Me, ex.Message)
                End Try
    
            End If

    Tuesday, June 18, 2019 2:23 PM
  • User-1300128566 posted

    Here the method ventanas.abreVentana works well

                        If tOrdTotal.Text < vMntMin Then
    
                            Session("CtrlMntMin") = vMntMin.ToString("F")
                            Session("CtrlCuryID") = HFCuryID.Value
    
                            Try
                                ventanas.abreVentana(Me, "winMtoMin.aspx", 400, 200, 483, 284)
                            Catch ex As Exception
                                ventanas.atrapaError(Me, ex.Message)
                            End Try
    
                            Session("procContinue") = "False"

    Here too... 

                    If CType(Session.Item("procContinue"), String) = "True" Then
    
                        ' Seleccionar la forma de surtimiento
                        Try
                            ventanas.abreVentana(Me, "winSurtMode.aspx", 400, 200, 483, 284)
                        Catch ex As Exception
                            ventanas.atrapaError(Me, ex.Message)
                        End Try
    

    Both in the button "Next" Click, but here in the timer tick does not work well

            If vSurtMode <> "" And vFactMen = "" And Not vProccessOK Then
                ' Ventana de aceptar facturas por importes menores
                vprocFactOK = "True"
    
                Try
                    ventanas.abreVentana(Me, "winFactImpMen.aspx", 400, 200, 483, 284)
                Catch ex As Exception
                    ventanas.atrapaError(Me, ex.Message)
                End Try
    
            End If

    Tuesday, June 18, 2019 3:26 PM
  • User-719153870 posted

    Hi rodolfomilano,

    I'm sorry that I still can't understand what you want to achieve through your description.

    What window will your button trigger?

    Where exactly are these window events triggered?

    Your button is outside the updatepanel. How are you going to use it to trigger a local refresh of the updatepanel?

    How do you connect your timer and button?

    It would be helpful if you could use a GIF or other way to show your needs. A more concise demo would be perfect.

    Best Regard,

    Yang Shen

    Wednesday, June 19, 2019 10:09 AM