Mar 12, 2012, 1:22 PM
[CLOSED] I wish get the parent ID in Code Behind
Hi!
Hi! I create a window in code behind (test23.aspx code) and I´m loading a aspx page (test24.aspx) within of window.
I wish, in a codebehind procedure of test24.aspx, get the ID of window that contains the test24.aspx.
Follow a little sample! In procedure ShowWindowParentID of test14.aspx, I wish get the window ID.
Test23.aspx
Hi! I create a window in code behind (test23.aspx code) and I´m loading a aspx page (test24.aspx) within of window.
I wish, in a codebehind procedure of test24.aspx, get the ID of window that contains the test24.aspx.
Follow a little sample! In procedure ShowWindowParentID of test14.aspx, I wish get the window ID.
Test23.aspx
<!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.Render()
wnd.Show()
End Sub
Protected Function getWindow(Optional url As String = "~/test24.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
Dim btn As Ext.Net.Button
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
wnd.CloseAction = CloseAction.Destroy
wnd.Width = 500
wnd.Height = 400
btn = New Ext.Net.Button
btn.ID = "btnOk"
btn.Text = "Ok"
btn.TextAlign = ButtonTextAlign.Center
btn.Icon = Icon.Accept
'btn.OnClientClick = wnd.ClientID & ".getBody().Ext.net.DirectMethods.SaveRecord();"
wnd.Buttons.Add(btn)
btn = New Ext.Net.Button
btn.ID = "btnCancel"
btn.Text = "Cancel"
btn.TextAlign=ButtonTextAlign.Center
btn.Icon = Icon.Cancel
btn.OnClientClick = wnd.ClientID & ".close();"
wnd.Buttons.Add(btn)
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>
Test24.aspx<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test24.aspx.vb" Inherits="WebApplication3.Test24" %>
<%@ 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 ShowWindowParentID(sender As Object, evt As Ext.Net.DirectEventArgs)
Dim mb As New Ext.Net.MessageBox
mb.Alert("ParentID", "I wish show the parent window ID here!")
mb.Show()
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="resManagerSGCO" runat="server" Namespace="SuperaWeb.SGCO" />
<ext:Button runat="server" ID="btnGetParentWindowID" Text = "Show Parent Window ID" OnDirectClick="ShowWindowParentID" />
</form>
</body>
</html>
Last edited by Daniil; Mar 13, 2012 at 5:58 PM.
Reason: [CLOSED]