POST Thread: DirectMethod(). Why do postback the all page ?

  1. #1

    POST Thread: DirectMethod(). Why do postback the all page ?

    Hello Forum: I'm really wondering why any Direct Method must be calling from
    any part of the page make a postback. I'm adding an example from my programming.

    <javascript>
    function openVincular(Tipo) {
     document.getElementById("hfEstadoVinMapa").value = Tipo;
     App.direct.OpenVentanaVincular(Tipo);
     }
     </javascript>
    
     <Html>
     <asp:ImageButton id="ibVincularFicha" runat="server" ImageUrl="Images/MapasGeo/09.png" BorderStyle="Outset" OnClientClick="openVincular(1); return false;" BorderWidth="1px" ToolTip="Fichas Vincular" BorderColor="White" ></asp:ImageButton>
     </Html>
    <ServerSide>
    <DirectMethod()> _
     Public Sub OpenVentanaVincular(ByVal tipo As Integer)
     Me.Cargar_UnidadesVin()
     Me.cboGestionvin.Clear()
     Me.cboFicMod.Store.Clear()
     Me.txtDescripcionFichas.Text = ""
     Me.cboFicMod.Clear()
     Me.storeFicMod.RemoveAll()
     Me.grvListaFichasVin.ClearContent()
     Me.Window7.Show()
     Ext.Net.X.Js.AddScript("App.Window7.alignTo(Ext.ge tBody(), 'tl', [90, 150]); App.Window7.expand();")
     End Sub
     </ServerSide>
    By the way, even with ext.net Button does the same results.

    <Ext.Net Buttom>
     <ext:Button ID="btProcesar" runat="server"
     Text="Procesar"
     Icon="PaintbrushColor" >
     <ToolTips>
     <ext:ToolTip runat="server" ID="ttProcesar" Title="Procesar Clasificación" Width="125" TitleAlign="Center"></ext:ToolTip>
     </ToolTips>
     <DirectEvents>
     <Click OnEvent="LlenarItemsClass" Timeout="100000" Before="Ext.Msg.wait('Procesando datos...', 'Agregando clasificaciones');" Failure="Ext.Msg.hide();" >
     </Click>
     </DirectEvents> 
     </ext:Button>
     </Ext.Net Buttom>
    Please, I need any way for not make a postback. Why, I need this because I have a MapControl,
    and this working with postback if one feature map is hard to load for first time, this direct
    method reload again. And I trying to figure it out why ext.net makes a postback a "windows"
    is not necessary for reload the whole page.

    Best Regards
    Interzone Developers.
    Last edited by Daniil; Aug 21, 2015 at 8:25 AM. Reason: Please use [CODE] tags
  2. #2
    Hi @jhuamani,

    I am not sure I understand the problem. A DirectMethod should not reload a page with a hard PostBack. Does that happen?

    Or maybe you mean that a form is being submitted? Yes, by default if there is a <form runat="server"> on the page, it is being submitted. To change it please use this attribute for a DirectMethod.
    [DirectMethod(Type = DirectEventType.Load)]
    Here is a full example.

    Example
    <%@ Page Language="C#" %>
    
    <script runat="server">
        [DirectMethod(Type = DirectEventType.Load)]
        public void TestDirectMethod()
        {
            X.Msg.Alert("No submit", this.TextField1.Text).Show();
        }
    </script>
    
    <!DOCTYPE html>
    <html>
    <head runat="server">
        <title>Ext.NET v3 Example</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
    
            <ext:TextField ID="TextField1" runat="server" />
    
            <ext:Button runat="server" Text="Test DirectMethod" Handler="App.direct.TestDirectMethod();" />
        </form>
    </body>
    </html>
  3. #3
    ok dani thank you very much for the contribution, I solved the problem

Similar Threads

  1. [CLOSED] Page PostBack Query
    By vijay.sahu in forum 2.x Legacy Premium Help
    Replies: 4
    Last Post: Apr 04, 2013, 11:43 AM
  2. How to maintain page index after postback.
    By itskvini in forum 1.x Help
    Replies: 3
    Last Post: Jul 05, 2012, 1:27 PM
  3. [1.3]How to prevent DirectMethod use POST
    By firebank in forum 1.x Help
    Replies: 3
    Last Post: Apr 09, 2012, 1:31 PM
  4. [CLOSED] Cross-page Postback
    By alliedwallet.com in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 16, 2011, 1:19 PM
  5. Ext control invisible after postback of page.
    By Rupesh in forum 1.x Help
    Replies: 7
    Last Post: Sep 17, 2010, 5:11 AM

Posting Permissions