[CLOSED] Parameters or variables sent from parent page

  1. #1

    [CLOSED] Parameters or variables sent from parent page

    I need to use parameters or variables in child page, these parameters are sent from a parent page, for example:

    this is my application, the home page (parent page) is composed of a viewport with a TabPanel in the center and on the left menu:

    Click image for larger version. 

Name:	Captura.JPG 
Views:	125 
Size:	41.5 KB 
ID:	5572

    By clicking on any of the menu options, for example I click on "Contracts", shows the following:

    Click image for larger version. 

Name:	Captura2.JPG 
Views:	143 
Size:	95.3 KB 
ID:	5573

    shows the catalog of contracts (child page), it and each of the menu items are aspx files

    I want to click on the contracts or any other, send a parameter that can be used in the codebehind of contratos.aspx (child page)

    I hope to be clear in my problem and I hope you can help me,
    thanks!
    Last edited by Daniil; Sep 25, 2013 at 5:23 AM. Reason: [CLOSED]
  2. #2
    If you're loading the inner page into an iframe, how about send the extra information as a parameter of the Url?
    Geoffrey McGill
    Founder
  3. #3
    maybe I did not explain well,

    in the codebehind of page contratos.aspx, I need to use a variable that contains an identifier of the option contratos.aspx, that identifier or parameter is extracted from the database,

    I will use this parameter to validate permissions on contratos.aspx.

    Permissions to modify, to add new record, to delete a record, etc.
  4. #4
    Quote Originally Posted by JCarlosF View Post
    maybe I did not explain well,

    in the codebehind of page contratos.aspx, I need to use a variable that contains an identifier of the option contratos.aspx, that identifier or parameter is extracted from the database,

    I will use this parameter to validate permissions on contratos.aspx.

    Permissions to modify, to add new record, to delete a record, etc.
    Hello!

    I don't quite understand you.

    You have a Parent Page which has some parameter and you want to use this parameter on CodeBehind side of second page when it opens? If I'm right please try the following approach:

    ParentPage.aspx
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Window win = new Window()
            {
                ID = "Window1",
                Title = "Child Page",
                Width = Unit.Pixel(400),
                Height = Unit.Pixel(200),
                Modal = true,
                AutoRender = false,
                Collapsible = true,
                Maximizable = true,
                Hidden = true,
                Loader = new ComponentLoader
                {
                    Url = "~/ChildPage.aspx",
                    Mode = LoadMode.Frame,
                    LoadMask =
                    {
                        ShowMask = true
                    }
                }
            };
            
            // Here you can put any value
            win.Loader.Params.Add(new Ext.Net.Parameter("myparam", "Parameter from parent page", ParameterMode.Value));
    
            this.Form.Controls.Add(win);
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET Examples</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:Button runat="server" Text="Show Window" Icon="Application">
                <Listeners>
                    <Click Handler="#{Window1}.show(this);" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    ChildPage.aspx

    <%@ Page Language="C#" EnableViewState="true" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            ParamField.Text = Request.Params["myparam"];
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Portlet drop test</title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:TextField runat="server" FieldLabel="Received Parameter" ID="ParamField" Width="300"></ext:TextField>
    </body>
    </html>
  5. #5
    Thanks, this solved my problem very well
  6. #6
    hi - Regarding this Thread: The Solution above seems good if you only need to pass in a single parameter.

    Could you expand on this, and recommend a solution for passing more complex data to the child form?
    For example:

    Question: How would you suggest to pass a "HashTable" from parent page, into the child page?
  7. #7
    Hi @VirtualArtists,

    According to the fact that a request can transmit strings only. A HastTable should be serialized on the parent page and deserialized on the child page. It looks the only solution if you need to send that parameter through a request. Another solution could storing the parameter somewhere on the server, for example in the Application global object.
  8. #8
    Quote Originally Posted by Baidaly View Post
    Hello!

    I don't quite understand you.

    You have a Parent Page which has some parameter and you want to use this parameter on CodeBehind side of second page when it opens? If I'm right please try the following approach:

    ParentPage.aspx
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            Window win = new Window()
            {
                ID = "Window1",
                Title = "Child Page",
                Width = Unit.Pixel(400),
                Height = Unit.Pixel(200),
                Modal = true,
                AutoRender = false,
                Collapsible = true,
                Maximizable = true,
                Hidden = true,
                Loader = new ComponentLoader
                {
                    Url = "~/ChildPage.aspx",
                    Mode = LoadMode.Frame,
                    LoadMask =
                    {
                        ShowMask = true
                    }
                }
            };
            
            // Here you can put any value
            win.Loader.Params.Add(new Ext.Net.Parameter("myparam", "Parameter from parent page", ParameterMode.Value));
    
            this.Form.Controls.Add(win);
        }
    </script>
    
    <!DOCTYPE html>
    
    <html>
    <head runat="server">
        <title>Ext.NET Examples</title>
    </head>
    <body>
        <form runat="server">
            <ext:ResourceManager runat="server" />
            
            <ext:Button runat="server" Text="Show Window" Icon="Application">
                <Listeners>
                    <Click Handler="#{Window1}.show(this);" />
                </Listeners>
            </ext:Button>
        </form>
    </body>
    </html>
    ChildPage.aspx

    <%@ Page Language="C#" EnableViewState="true" %>
     
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <script runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            ParamField.Text = Request.Params["myparam"];
        }
    </script>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Portlet drop test</title>
    </head>
    <body>
        <ext:ResourceManager ID="ResourceManager1" runat="server" />
        <ext:TextField runat="server" FieldLabel="Received Parameter" ID="ParamField" Width="300"></ext:TextField>
    </body>
    </html>
    I just wondering so thats why I aske it ,what if he want to do this,(I mean adding tab and pass the parameters,) via usercontroler ascx,what would u advise.thank u
  9. #9
    Quote Originally Posted by ada View Post
    I just wondering so thats why I aske it ,what if he want to do this,(I mean adding tab and pass the parameters,) via usercontroler ascx,what would u advise.thank u
    I think it is a candidate for a new forum thread. Please start. If you feel the threads are related, please feel free to cross-link between the two.

Similar Threads

  1. [CLOSED] How to show ext:Window on Parent page in Nested page
    By ViDom in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 09, 2012, 2:33 PM
  2. Replies: 1
    Last Post: Feb 03, 2012, 2:36 PM
  3. [CLOSED] Child page to parent page call
    By majestic in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Oct 05, 2010, 5:41 PM
  4. can we add tab from content page to parent page.
    By Satyanarayana murthy in forum 1.x Help
    Replies: 6
    Last Post: May 27, 2010, 12:27 PM
  5. Replies: 5
    Last Post: Aug 04, 2009, 10:49 AM

Posting Permissions