Nov 15, 2017, 1:50 PM
[CLOSED] Page Load Is Firing Twice
Hi Community !
I have a problem using the Toolbar and TabMenu controlers: when clicking over a menu option, the app is actualizing twice.
A point of interruption must be inserted in the event Page_Load for the app TstComboBox.aspx, to recreate my problem.
Please check the code sample below:
Regards.
I have a problem using the Toolbar and TabMenu controlers: when clicking over a menu option, the app is actualizing twice.
A point of interruption must be inserted in the event Page_Load for the app TstComboBox.aspx, to recreate my problem.
Please check the code sample below:
<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!X.IsAjaxRequest)
{
btnPerfiles.StyleSpec = "color:#FFF;";
btnPerfiles.OverCls = "overbutton";
DesplegarMenu();
}
}
catch (Exception)
{
}
}
private void DesplegarMenu()
{
Ext.Net.MenuItem theMenuItem1 = new Ext.Net.MenuItem() { ID = "Modulo1", Text = "Modulo1" };
Ext.Net.Menu theMenu11 = new Ext.Net.Menu();
Ext.Net.MenuItem theMenuItem11 = new Ext.Net.MenuItem() { ID = "SubModulo11", Text = "SubModulo11" };
Ext.Net.MenuItem theMenuItem12 = new Ext.Net.MenuItem() { ID = "SubModulo12", Text = "SubModulo12" };
// theMenuItem11.Listeners.Click.Handler = "App.direct.CreaTab('TstGridPanelwithCheckbox','IdApp1','TstGridPanelwithCheckbox.aspx');";
theMenuItem12.Listeners.Click.Handler = "App.direct.CreaTab('TstComboBox','IdApp2','TstComboBox.aspx');";
theMenu11.Items.Add(theMenuItem11);
theMenu11.Items.Add(theMenuItem12);
theMenuItem1.Menu.Add(theMenu11);
menuModulo.Items.Add(theMenuItem1);
}
[DirectMethod]
public void CreaTab(string pstrTitlePanel, string pstrIdComponentLoader, string pstrLink)
{
try
{
Ext.Net.ComponentLoader theComponentLoader = new Ext.Net.ComponentLoader();
Ext.Net.Panel thePanel = new Ext.Net.Panel();
theComponentLoader.ID = "cmp" + pstrIdComponentLoader;
theComponentLoader.Url = pstrLink;
theComponentLoader.LoadMask.ShowMask = true;
theComponentLoader.LoadMask.Msg = "Cargando... ";
theComponentLoader.Mode = LoadMode.Frame;
thePanel.ID = "pnl" + pstrIdComponentLoader;
thePanel.Title = pstrTitlePanel;
thePanel.Closable = true;
thePanel.FocusOnToFront = false;
thePanel.Reorderable = true;
thePanel.Border = false;
thePanel.Loader = theComponentLoader;
thePanel.Height = 550;
thePanel.Layout = "Fit";
thePanel.LoadContent();
thePanel.AddTo(tbContenido);
thePanel.Render();
tbContenido.SetActiveTab(thePanel);
}
catch (Exception)
{
}
}
</script>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Launch Pad del Módulo A& T</title>
</head>
<body>
<ext:ResourceManager ID="ResourceManager1" runat="server" IDMode="Static" Theme="Neptune">
</ext:ResourceManager>
<ext:Toolbar ID="MainMenuBar" runat="server" Hidden="false">
<Items>
<ext:Button ID="btnPerfiles" runat="server" Text="Perfiles">
<Menu >
<ext:Menu runat="server" ID="menuModulo" >
</ext:Menu>
</Menu>
</ext:Button>
<ext:ToolbarSeparator/>
</Items>
</ext:Toolbar>
<ext:TabPanel ID="tbContenido" runat="server"
Region="Center"
Border="false">
<Plugins>
<ext:BoxReorderer ID="BoxReorderer1" runat="server" />
</Plugins>
</ext:TabPanel>
</body>
</html>
TstComboBox.aspx
<%@ Page Language="C#" AutoEventWireup="true" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
Store1.DataSource = new object[]
{
new {Text = "One", Value = 1},
new {Text = "Two", Value = 2},
new {Text = "Three", Value = 3},
new {Text = "Four", Value = 4},
new {Text = "Five", Value = 5},
};
Store1.DataBind();
}
}
</script>
<!DOCTYPE html>
<html>
<head id="Head1" runat="server">
<title>Edit Form View - Ext.NET Examples</title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" />
<ext:Window ID="FormWindow" runat="server"
Title="Form View"
Width="440"
Height="310"
BodyPadding="15"
Resizable="false"
Closable="false"
Layout="Fit">
<Items>
<ext:FormPanel ID="FormPanel1" runat="server"
Border="false"
Layout="Form">
<Items>
<ext:ComboBox ID="ComboBox1" runat="server"
Name="Name1"
MsgTarget="Side"
AllowBlank="false"
ValueField="Value"
DisplayField="Text"
BlankText="Campo Number es obligatorio"
EmptyText="Seleccionar Number..."
FieldLabel="Field ComboBox1" >
<Store>
<ext:Store ID="Store1" runat="server" AutoLoad="false" >
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="Value"/>
<ext:ModelField Name="Text" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<Triggers>
<ext:FieldTrigger Icon="Clear" Hidden="true" QTip="Limpia Selección" />
</Triggers>
<Listeners>
<BeforeQuery Handler="this.getTrigger(0)[this.getRawValue().toString().length == 0 ? 'hide' : 'show']();" />
<Change Handler="this.getTrigger(0).show();" />
<TriggerClick Handler="if (index == 0)
{
this.reset();
this.getTrigger(0).hide();
}
"/>
</Listeners>
</ext:ComboBox>
</Items>
</ext:FormPanel>
</Items>
</ext:Window>
</form>
</body>
</html>
Any help would be appreciatedRegards.
Last edited by fabricio.murta; Nov 17, 2017 at 4:25 PM.