PDA

View Full Version : [CLOSED] Creating and Show ext.Window in CodeBehind



supera
Mar 08, 2012, 2:58 PM
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?

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>

Daniil
Mar 08, 2012, 4:16 PM
Hi,

A Window is not rendered, please call:

wnd.Render();
instead of Show.

supera
Mar 08, 2012, 4:31 PM
Works fine!

Thanks a lot!