Sep 03, 2019, 8:15 AM
Panel.Loader.Url not working out of PageLoad
Basically I have 2 panels in my aspx file "Productos.aspx", one called "panelizq" on the left with a treepanel and one called "panelarticulos" on the right where I would like to load my "ViewportartÃ*culos.aspx" page when I click on the tree panel.
The thing is that I can only load "ViewportartÃ*culos.aspx" on "panelarticulos" in the pageload. When i try to do it by clicking on the tree, nothing happens.
Productos.aspx:
Here I make the first load, that is working and I create the treepanel (this works nice)
The thing is that I can only load "ViewportartÃ*culos.aspx" on "panelarticulos" in the pageload. When i try to do it by clicking on the tree, nothing happens.
Productos.aspx:
<%@ Page Title="Extranet Jhayber" Language="C#" CodeBehind="Productos.aspx.cs" Inherits="TestB2BDeporte.Productos" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="CalzadoExtranet" runat="server"></head>
<body>
<form id="formGeneral" runat="server">
<ext:ResourceManager ID="ResourceManagerExt" runat="server" IDMode="Explicit" AjaxTimeout="180000"/>
<ext:Viewport ID="Viewport1" runat="server" Layout="columnlayout" cls="backgroundcls" Frame="true">
<Items>
<ext:Panel ID="panelizq" runat="Server" Width="240" Frame="false" Layout="ColumnLayout" AutoScroll="false" cls="Menutabs" Scrollable="Vertical">
<Items>
<ext:Label runat="server" id="Filas" Text="" Hidden="true"></ext:Label>
<ext:Label runat="server" id="Paginas" Text="" Hidden="true"></ext:Label>
<ext:Label runat="server" id="logintext" Text="" Hidden="true"></ext:Label>
<ext:Label runat="server" id="clientetext" Text="" Hidden="true"></ext:Label>
<ext:Label runat="server" id="paginaactualtext" Text="" Hidden="true"></ext:Label>
<ext:Label runat="server" id="filtrotext" Text="" Hidden="true"></ext:Label>
<ext:formPanel runat="server" Cls="Buscador" ColumnWidth="1" Layout="ColumnLayout" MarginSpec="30 0 30 0">
<KeyMap>
<ext:KeyBindItem Key="ENTER" Handler="App.direct.Filtrar();" />
</KeyMap>
<Items>
<ext:TextField runat="server" ID="buscatext" MarginSpec="7 0 0 15" Width="203" Cls="buscador" ColumnWidth="0.85">
<RightButtons>
<ext:Button runat="server" Icon="Magnifier" ID ="lupa">
<DirectEvents>
<Click DisableControl="true" OnEvent="Filtrar"></Click>
</DirectEvents>
</ext:Button>
</RightButtons>
</ext:TextField>
</Items>
</ext:formPanel>
</Items>
</ext:Panel>
<ext:Panel ID="panelarticulos" runat="Server" ColumnWidth="1" height="800" Frame="false" autoscroll="true" Cls="panelarticuloscls">
<Loader runat="server" Mode="Frame">
<LoadMask ShowMask="true" MsgCls="loader" Msg="Cargando"/>
</Loader>
</ext:Panel>
</Items>
</ext:Viewport>
</form>
</body>
</html>
Productos.aspx.cs:Here I make the first load, that is working and I create the treepanel (this works nice)
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
panelarticulos.Loader.Url = "ViewportArticulos.aspx?login=" + logintext.Text;
panelarticulos.LoadContent();
}
// CREO LOS Buttons
int x = 0;
int z = 0;
int i = 0;
var treeStore = new TreeStore();
Toolbar toolBar = new Toolbar();
Ext.Net.TreePanel tree = new Ext.Net.TreePanel();
tree.RootVisible = false;
tree.ID = "TreePanel1";
tree.AutoScroll = true;
Ext.Net.Node root = new Ext.Net.Node()
{
Text = "Catálogo",
};
root.Expanded = true;
CategoriaDao Cat = new CategoriaDao();
List<Categoria> Categorias = Cat.getAll();
int cat = 0;
foreach (Categoria categoria in Categorias)
{
cat++;
FamiliaDao Fam = new FamiliaDao();
List<string> Sexos = Fam.GetDistinctSexos(categoria.Id);
if(Sexos.Count > 0)
{
Ext.Net.Node CatNode = new Ext.Net.Node()
{
NodeID = categoria.Id.ToString(),
Text = (categoria.Nombre.Substring(0, 1).ToUpper() + categoria.Nombre.Substring(1).ToLower()).Trim(),
};
root.Children.Add(CatNode);
foreach (string S in Sexos)
{
List<string> Familias = Fam.GetFamiliaByCategoriaYSexo(categoria.Id, S);
if (Familias.Count > 0)
{
Ext.Net.Node SexNode = new Ext.Net.Node()
{
NodeID = categoria.Id.ToString() + "/%"+S.Trim()+ "%",
Text = (S.Substring(0, 1).ToUpper() + S.Substring(1).ToLower()).Trim(),
};
CatNode.Children.Add(SexNode);
foreach (string familia in Familias)
{
Ext.Net.Node FamNode = new Ext.Net.Node()
{
NodeID = categoria.Id.ToString() + "/%" + S.Trim() + "%/%" + familia.Trim()+"%",
Text = (familia.Substring(0, 1).ToUpper() + familia.Substring(1).ToLower()).Trim(),
Leaf = true
};
SexNode.Children.Add(FamNode);
}
}
}
}
}
root.Expanded = true;
treeStore.Root.Add(root);
tree.Store.Add(treeStore);
tree.ColumnWidth = 1;
tree.Frame = false;
tree.Cls = "clstree";
tree.Listeners.ItemClick.Handler = "App.direct.Filtrado(record.data.id);";
panelizq.Add(tree);
}
And here is where the event that fires when the tree panel is clicked and where the loader fails and does nothing.[DirectMethod]
public void Filtrado(string Id)
{
string argumentos = "";
string [] separadas;
separadas = Id.Split('/');
switch(separadas.Count())
{
case 1:
argumentos = "where categoria = " + separadas[0];
break;
case 2:
argumentos = "where categoria = " + separadas[0] + " and Sexo like '" + separadas[1] + "'";
break;
case 3:
argumentos = "where categoria = " + separadas[0] + " and Sexo like '" + separadas[1] + "' and familia like '" + separadas[2] + "'";
break;
}
argumentos = argumentos.Replace("'", "/-/");
SessionVariablesDao SSD = new SessionVariablesDao();
SSD.UpdateTo2(Convert.ToInt32(logintext.Text), "-1", "-1", "-1", argumentos, "-1", "-1", "-1", -1, -1, -1, DateTime.Now, -1);
//THIS IS NOT WORKING//
panelarticulos.Loader.Url = "ViewportArticulos.aspx?login=" + logintext.Text;
this.panelarticulos.LoadContent();
////
}