PDA

View Full Version : [CLOSED] Creating ext:Window in CodeBehind.Button aligment



supera
Mar 08, 2012, 4:11 PM
Hi! I'm creating a ext:window in codebehind and this window has two buttons: Ok and Cancel...

In first time that the ext:window is created, the 'Ok' button is set to center align (this is correct)
But the other times that the ext:window is created, the 'Ok' button is aligned to left...

Follow below a test page to exemplify my problem:



<%@ 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.Render()
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
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

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>

Vladimir
Mar 08, 2012, 6:07 PM
Hi,

Did you close the window before open new windows?

Daniil
Mar 08, 2012, 7:25 PM
Hi,

Please try to set up:

wnd.CloseAction = CloseAction.Destroy

supera
Mar 09, 2012, 10:13 AM
Hi Daniil!

Solved!

Thanks a lot!