My main.aspx
<ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Gray" />
<form id="form2" runat="server">
<ext:Panel runat="server" ID="anaPanel" Title="OSO" Icon="Car">
<TopBar>
<ext:Toolbar runat="server" Layout="FitLayout">
<Items>
<ext:Menu ID="Menu1" runat="server" Floating="false" Layout="HBoxLayout" ShowSeparator="false"
AnimCollapse="true" Cls="horizontal-menu">
<Defaults>
<ext:Parameter Name="MenuAlign" Value="tl-bl?" Mode="Value" />
</Defaults>
<Items>
<ext:MenuItem ID="MenuItem1" runat="server" Text="" Icon="Group">
<Menu>
<ext:Menu ID="Menu2" runat="server">
<Items>
<ext:MenuItem Text="new card" Icon="GroupAdd">
<DirectEvents>
<Click OnEvent="AddNewCart_Click"></Click>
</DirectEvents>
</ext:MenuItem>
...............
...............
</ext:Panel>
</form>
My maninpage codebehind something like this.
protected void AddNewCart_Click(object sender, DirectEventArgs e)
{
string path = "Pages/Kart.aspx";
Window win = CreateWindows(MyWindow,Icon.Group,path,"new card", 420, 500);
// private Window CreateWindow(string Id, Icon ic, string path, string Title, int Heigh, int width){......};
//I get the new Window and pass some values and turn it back.
win.Render(this.Form);
win.Show();
}
inside Kart.aspx there is also a button and when the clicked button , load second childpage just the same above code but changed path (lets say loading B.aspx).I am doing this like that window.parent.App.direct.MethodName(). *[MethodName() descibed in the main.aspx] but I need to refresh a grid inside the Kart.aspx, when and new item from B.aspx, *I have tried to reach Kart.aspx methon like this window.parent.App.direct.MethodName() but seems doesnt work.it works only if it is described in the main.aspx codebehind. a friend told me that ,only way to do that is use javascript" like this
Code-Behind
X.Call("ReloadGrid");
function ReloadGrid() {
var grid = window.parent.Ext.getCmp('GridId');
//grid reloading code
}
but I have no idea how I reload grid via this script.or are there anaother way to do this.thank you
my Kart.aspx ;
<ext:GridPanel runat="server" ID="grid1" Title="" Height="460"
Flex="1" Scroll="Vertical">
<Store>
<ext:Store ID="strKart" runat="server">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="Id">
<Fields>
<ext:ModelField Name="Id" />
<ext:ModelField Name="name" />
<ext:ModelField Name="surname" />
</Fields>
</ext:Model>
</Model>
<Listeners>
<Exception Handler="Ext.Msg.alert('Products - Load failed', operation.getError());" />
</Listeners>
</ext:Store>
</Store>
and code behind of it
[DirectMethod]
public void ReloadKart()
{
this.strKart.DataSource = cari_bll.GetAll();
this.strKart.DataBind();
}
**trying to run ReloadKart () function from B.aspx which is clicked the button
Now you have 3 pages, the parent lets call it Parent.aspx, and the children Kart.aspx, and b.aspx
And you want to load the grid in Kart.aspx based on an event in b.aspx
Since you load the grid by calling the direct method
its boils down to calling this method inside Kart.aspx
To achieve this you need to do the following:
Define a JavaScript method in Kart.aspx that calls the direct method
ReloadKart
, lets name it ReloadGridDefine a delegate to this method in Parent.aspx, lets call it
ReloadGridDelegate
, a method to call that delegateCallKartReloadGrid
, and a method to set itSetReloadGridDelegate
In Kart.aspx assign call the
SetReloadGridDelegate
Finally in b.aspx call the parent method