[CLOSED] Creating and Show ext.Window in CodeBehind

  1. #1

    [CLOSED] Creating and Show ext.Window in CodeBehind

    Hi!

    Im trying create and show a ext:Window in codebehind... but I get the error 'Run time error: Can not get the value of the property 'show': object is null or not defined" ...

    What I do wrong?

    Attachment 3921

    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test23.aspx.vb" Inherits="WebApplication3.Test23" %>
    <%@ 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 AddWindow(sender As Object, evt As Ext.Net.DirectEventArgs)
            Dim wnd As Ext.Net.Window
            wnd = getWindow()
            Me.Form.Controls.Add(wnd)
            wnd.Show()
        End Sub
        
        Protected Function getWindow(Optional url As String = "~/test22.aspx", Optional pTitle As String = "test", Optional iconUrl As String = "") As Ext.Net.Window
            Dim wnd As New Ext.Net.Window
            Dim loader As New Ext.Net.ComponentLoader
    
            loader.Url = url
            loader.Mode = Ext.Net.LoadMode.Frame
            loader.LoadMask.ShowMask = True
            loader.LoadMask.Msg = "Carregando..."
    
            wnd.ID = "window_" & (New System.Random).Next(Integer.MaxValue).ToString
            wnd.Title = pTitle
            If iconUrl <> "" Then
            Else
                wnd.Icon = Ext.Net.Icon.ApplicationForm
            End If
            wnd.AutoRender = False
            wnd.Collapsible = False
            wnd.Hidden = True
            wnd.AutoRender = False
            wnd.Maximizable = False
            wnd.Loader = loader
    
            'width, heigth e position, cada pgina, passada em url, vai setar.
            'wnd.Show()
    
            Return wnd
    
        End Function
        
    </script>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <ext:ResourceManager ID="resManagerSGCO" runat="server" Namespace="SuperaWeb.SGCO" /> 
        <form id="form1" runat="server">
        <div>
            <ext:Button runat="server" ID="btnCreateWindow" Text="Create and Show Window" OnDirectClick="addWindow" />
        </div>
        </form>
    </body>
    </html>
    <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test22.aspx.vb" Inherits="WebApplication3.Test22" %>
    
    <!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 runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        fdassafdsa
        </div>
        </form>
    </body>
    </html>
    Last edited by Daniil; Mar 08, 2012 at 4:06 PM. Reason: [CLOSED]
  2. #2
    Hi,

    A Window is not rendered, please call:
    wnd.Render();
    instead of Show.
  3. #3
    Works fine!

    Thanks a lot!

Similar Threads

  1. [CLOSED] Creating Combobox + Store in CodeBehind
    By trezv in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 12, 2015, 1:41 PM
  2. Replies: 3
    Last Post: Mar 19, 2012, 12:35 PM
  3. [CLOSED] Creating ext:Window in CodeBehind.Button aligment
    By supera in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Mar 09, 2012, 10:13 AM
  4. [CLOSED] Creating DirectEvent from codebehind
    By krzak in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 01, 2011, 10:17 AM
  5. Creating a Store From CodeBehind
    By ahmetmeral in forum 1.x Help
    Replies: 5
    Last Post: Dec 14, 2008, 5:14 PM

Posting Permissions