Apr 02, 2012, 5:42 PM
[CLOSED] DirectMethod function: I wish cascading calls and receive returns.
Hi!
I have a main page with two ext:panels. In each panel, I'm loading a page.
The idea is that the first page contains filters and the second page contains a grid with data.
I'd like that before grid refresh, is received the selected filters in filter page.
But I do not know how to get the result of the function.
I call the directMethod with Ext.Net.X.Js.Call.
The grid Page call a directMethod function in Main Page and Main Page call a directMethod function in Filter Page.
I don´t following the example in https://examples2.ext.net/#/Events/D...hods/Overview/ because I need that result is returned in a sub or function, because I need work over the return.
I made a simple sample.
Main Page (test50.aspx)
I have a main page with two ext:panels. In each panel, I'm loading a page.
The idea is that the first page contains filters and the second page contains a grid with data.
I'd like that before grid refresh, is received the selected filters in filter page.
But I do not know how to get the result of the function.
I call the directMethod with Ext.Net.X.Js.Call.
The grid Page call a directMethod function in Main Page and Main Page call a directMethod function in Filter Page.
I don´t following the example in https://examples2.ext.net/#/Events/D...hods/Overview/ because I need that result is returned in a sub or function, because I need work over the return.
I made a simple sample.
Main Page (test50.aspx)
<%@ Page Language="vb" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
<DirectMethod()>
Public Function GetValueInTest50() As String
Ext.Net.X.Msg.Alert("GetValueInTest50", "Here, I want call the directmethod function in Test51 aspx Page and and return the result to Test52 aspx Page.").Show()
Return ""
End Function
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test 50</title>
</head>
<body>
<ext:ResourceManager ID="resManagerExplorerWEB" runat="server" Locale="pt-BR" />
<form id="form1" runat="server">
<ext:Viewport runat="server" ID="viewPort2" Layout="BorderLayout">
<Items>
<ext:Panel ID="panelLeft" runat="server" Region="West" Flex="1" Width="300" MinWidth="300" MaxWidth="350" Split="true" layout="AnchorLayout" BodyPadding="0">
<Loader ID="loadFilter" runat="server" Mode="Frame" Url="test51.aspx">
<LoadMask ShowMask="true" Msg="Carregando..."/>
</Loader>
</ext:Panel>
<ext:Panel ID="panelCenter" runat="server" Region="Center" Flex="1" layout="FitLayout" BodyPadding="0">
<Loader ID="loadPanel" runat="server" Mode="Frame" Url="test52.aspx">
<LoadMask ShowMask="true" Msg="Carregando..."/>
</Loader>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
Page that needs the function value of directmethod function (test52.aspx)<%@ Page Language="vb" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub CallGetValueInTest50()
'Ext.Net.X.Js.Call("parent.App.direct.GetFilter({success: function(result){ App.txtExternalFilter.setValue(result); alert(App.txtExternalFilter.getValue());}});")
Ext.Net.X.Msg.Alert("CallGetValueInTest50", "Here, I want call the directmethod function in Test50 aspx Page and receive the return of the function for set in lblResult.").Show()
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<ext:ResourceManager ID="resManagerExplorerWEB" runat="server" Locale="pt-BR" />
<form id="form1" runat="server">
<div>
<ext:Viewport runat="server" ID="viewPort2" Layout="AbsoluteLayout">
<Items>
<ext:Label runat="server" ID="lblTitle" X="10" Y="5" Text="Test52 aspx Page" />
<ext:Button runat="server" ID="bt1" X="10" Y="45" Text="Call 'GetValue' in Test51.aspx page'" OnDirectClick="CallGetValueInTest50" />
<ext:Label runat="server" ID="lblResult" X="10" Y="95" />
</Items>
</ext:Viewport>
</div>
</form>
</body>
</html>
Page that contains the value to be rescued by directmethod function (test51.aspx)<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test51.aspx.vb" Inherits="WebApplication3.Test51" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
<DirectMethod()>
Public Function GetValueInTest51() As String
Return txt1.Text
End Function
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test 51</title>
</head>
<body>
<ext:ResourceManager ID="resManagerExplorerWEB" runat="server" Locale="pt-BR" />
<form id="form1" runat="server">
<ext:Viewport runat="server" ID="viewPort2" Layout="AbsoluteLayout">
<Items>
<ext:Label runat="server" ID="lblTitle" X="3" Y="5" Text="Test51 aspx Page" />
<ext:Label runat="server" ID="lbl1" X="3" Y="45" Text="This page contains a directmethod function called 'GetValue' which should return the value of the textfield." />
<ext:TextField runat="server" ID="txt1" X="3" Y="105" FieldLabel="Source value" Text="50" />
</Items>
</ext:Viewport>
</form>
</body>
</html>
Last edited by geoffrey.mcgill; Apr 02, 2012 at 7:12 PM.
Reason: [CLOSED]