PDA

View Full Version : [CLOSED] Load Dynamic External Url in Window



profitsistemas
Feb 22, 2013, 2:42 PM
Hello, here is my case: I have a GridPanel with some rows. I have a button and on click event i need to show a window with some url using params from the selected row. I can't make my window to load the url.

Here is a sample for showing what i am doing:


<%@ Page Language="C#" AutoEventWireup="true" %>

<%@ 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">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script runat="server">

public class Example
{
private int _ID;
public int ID
{
get { return _ID; }
set { _ID = value; }
}

private int _ResultId;

public int ResultId
{
get { return _ResultId; }
set { _ResultId = value; }
}

private DateTime _StartDate;
public DateTime StartDate
{
get { return _StartDate; }
set { _StartDate = value; }
}


}

protected void btnDetalle_click(object sender, DirectEventArgs e)
{
RowSelectionModel sm = this.GridPan.SelectionModel.Primary as RowSelectionModel;
if (sm.SelectedRow != null)
{
string id = sm.SelectedRow.RecordID;

this.winLog.Show();

this.winLog.LoadContent(this.Page.ResolveUrl("log.aspx?exe_id=" + id));

}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
List<Example> list = new List<Example>();
Example item = new Example();
item.ID=1;
item.ResultId = 1;
item.StartDate = DateTime.Now;
list.Add(item);

item = new Example();
item.ID=2;
item.ResultId = 1;
item.StartDate = DateTime.Now;
list.Add(item);

item = new Example();
item.ID=3;
item.ResultId = 1;
item.StartDate = DateTime.Now;
list.Add(item);

this.StoreJobs.DataSource =list ;
this.StoreJobs.DataBind();
}
}

</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server">
</ext:ResourceManager>

<ext:GridPanel ID="GridPan" runat="server" Layout="FitLayout">
<Store>
<ext:Store ID="StoreJobs" runat="server">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="ID" >
<Fields>
<ext:ModelField Name="StartDate" Type="Date" />
<ext:ModelField Name="ResultId" Type="Int" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:DateColumn Text="Fecha" Format="dd/MM/Y hh:mm:ss" DataIndex="StartDate" Width="250" />
<ext:Column Text="Resultado" DataIndex="ResultId" Flex="1" >
</ext:Column>
</Columns>
</ColumnModel>
<SelectionModel >
<ext:RowSelectionModel ID="RowSelectionModel1" runat="server" >
<Listeners>
<Select Handler="#{btnDetalle}.setDisabled(false);" />
</Listeners>
</ext:RowSelectionModel>
</SelectionModel>
<TopBar>
<ext:Toolbar ID="ToolOpciones" runat="server">
<Items>
<ext:Button ID="btnDetalle" Disabled="true" runat="server" Text="Detalle" Icon="ApplicationViewDetail" OnDirectClick="btnDetalle_click">
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:GridPanel>
<ext:Window ID="winLog" runat="server" Hidden="true" Collapsible="false" Maximized="true" Minimizable="false" Modal="true"
Title="Log" Layout="FitLayout" Closable="true">
</ext:Window>
</form>
</body>
</html>

Vladimir
Feb 22, 2013, 3:18 PM
Try this


this.Panel1.LoadContent(new ComponentLoader() {
Url = "Url.aspx",
Mode = LoadMode.Frame
});

profitsistemas
Feb 22, 2013, 3:24 PM
@Vladimir I tried your suggestion but after adding that code my window isn't showing.

I wrote this but it's not working:


this.winLog.LoadContent(new ComponentLoader() { Url = "log.aspx?exe_id=1", Mode = LoadMode.Frame });

this.winLog.Show();

Vladimir
Feb 22, 2013, 3:34 PM
Please add Loader to the window


<Loader Mode="Frame" AutoLoad="false">
</Loader>

profitsistemas
Feb 22, 2013, 3:41 PM
Thanks @Vladimir! It's working ok now