Oct 21, 2011, 11:48 AM
[CLOSED] Reload Clild Iframe after delete item.
Hi guys,
I have an Problem. After delete an item of the list I can not reload the page.
Please, look below my example:
Parent:
Child:
Any suggestion?
Thanks in advance.
I have an Problem. After delete an item of the list I can not reload the page.
Please, look below my example:
Parent:
<%@ Page Language="C#" AutoEventWireup="true" %>
<!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 runat="server">
<title></title>
<script runat="server">
[DirectMethod]
public void Mensagem(string icone, string titulo, string mensagem)
{
if (icone.Equals("Info") || icone.Equals("Sucesso"))
{
X.Msg.Show(new MessageBoxConfig
{
Title = titulo,
Message = mensagem,
Buttons = MessageBox.Button.OK,
Icon = MessageBox.Icon.INFO
});
}
}
protected void ButtonTeste_Clique(object sender, DirectEventArgs e)
{
PanelComentario.LoadContent(new LoadConfig("Child.aspx")
{
Mode = LoadMode.IFrame,
Scripts = true,
MaskMsg = "Aguarde...",
ShowMask = true,
NoCache = true
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManagerComentarioLista" runat="server" DisableViewState="true" Theme="Gray">
</ext:ResourceManager>
<ext:Panel runat="server" ID="teste">
<Items>
<ext:Panel ID="PanelComentario" runat="server" Border="false" Title="Comentário" IconCls="Comentario" Height="300" Width="290" Padding="10" AutoScroll="true">
</ext:Panel>
<ext:Button runat="server" ID="ButtonTeste" Text="Load Iframe">
<DirectEvents>
<Click OnEvent="ButtonTeste_Clique">
</Click>
</DirectEvents>
</ext:Button>
</Items>
</ext:Panel>
</form>
</body>
</html>
Child:
<%@ 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>
<style type="text/css">
#BOXPostIt {clear:right;position:relative;width:235px;height:100px;float:right;left:-2px;top:-15px;margin:5px 3px 0px 0px;background-image:url("../Resources/images/bg/bgdicas.gif");}
#BOXPostIt_pq {clear:right;position:relative;width:125px;height:130px;float:right;left:-2px;top:-15px;margin:5px 3px 0px 0px;background-image:url("../Resources/images/bg/bgdicas.gif");}
#BOXPostItcontainer {clear:right;position:relative;float:left;top:13px;left:12px;}
#BOXPostIt01 {clear:right;position:relative;width:235px;height:100px;float:right;left:-151px;margin:5px 3px 0px 0px;background-image:url("../Resources/images/bg/bgdicas.gif");}
#BOXPostItcontainer01 {clear:right;position:relative;float:left;top:13px;left:12px;}
.BOXPostItTit {font-size:14px;font-weight:bold;color:#FF6600; margin:10px;}
.BOXPostItText {clear:both;font-size:11px;font-family:Arial, Verdana, Helvetica;}
.BOXPostItlnk:link {text-decoration:none;color:#003399;font-size:11px;font-weight:bold;font-family:Arial, Verdana, Helvetica;text-align:right;padding:10px;width:190px;}
.BOXPostItlnk:visited {text-decoration:none;color:#003399;font-size:11px;font-weight:bold;font-family:Arial, Verdana, Helvetica;}
.BOXPostItlnk:hover {text-decoration:underline;color:#ff6600;font-size:11px;font-weight:bold;font-family:Arial, Verdana, Helvetica;}
.BOXPostItlnk:active {text-decoration:none;color:#003399;font-size:11px;font-weight:bold;font-family:Arial, Verdana, Helvetica}
.excluir{ background-image:url("../Resources/icons/cross.png"); overflow: hidden}
.editar{ background-image:url("../Resources/icons/page_white_edit.png"); overflow: hidden}
</style>
<script type="text/javascript">
var excluir = function (id) {
Ext.net.DirectMethods.Confirma(id);
}
</script>
<script runat="server">
System.Collections.Generic.List<nota> notas;
public class nota
{
public int id { get; set; }
public string nome { get; set; }
public DateTime data { get; set; }
public string conteudo { get; set; }
}
protected void Page_Load(object sender, EventArgs e)
{
notas = new System.Collections.Generic.List<nota>()
{
new nota{id=1, nome="Nome1", conteudo="Conteudo1", data= DateTime.Now},
new nota{id=2, nome="Nome2", conteudo="Conteudo2", data= DateTime.Now},
new nota{id=3, nome="Nome3", conteudo="Conteudo3", data= DateTime.Now},
new nota{id=4, nome="Nome4", conteudo="Conteudo4", data= DateTime.Now}
};
this.ObjHolderComentario.Items.Add("notas", notas);
}
[DirectMethod]
public void Excluir_Clique(int notaID)
{
if (notaID > 0)
{
try
{
nota nota = notas.Find(a => a.id == notaID);
bool apagou = notas.Remove(nota);
if (apagou)
{
X.Js.Call("parent.Ext.net.DirectMethods.Mensagem", "Info", "Atenção", "Comentário excluído com sucesso!");
}
else
{
X.Js.Call("parent.Ext.net.DirectMethods.Mensagem", "Erro", "Erro", "O comentário não pôde ser excluído!");
}
}
catch (Exception)
{
X.Js.Call("parent.Ext.net.DirectMethods.Mensagem", "Erro", "Erro", "O comentário não pôde ser excluído!");
}
}
}
[DirectMethod]
public void Confirma(int notaID)
{
X.Msg.Confirm("Atenção", "Deseja excluir?", new MessageBoxButtonsConfig
{
Yes = new MessageBoxButtonConfig
{
Handler = "Ext.net.DirectMethods.Excluir_Clique(" + notaID + ")",
Text = "Sim"
},
No = new MessageBoxButtonConfig
{
Handler = "return;",
Text = "Não"
}
}).Show();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager ID="ResourceManagerComentarioLista" runat="server" DisableViewState="true" Theme="Gray">
</ext:ResourceManager>
<ext:ObjectHolder ID="ObjHolderComentario" runat="server" />
<ext:XTemplate ID="TplComentario" runat="server" >
<Html>
<tpl for=".">
<div id="BOXPostIt">
<div id="BOXPostItcontainer">
<table width="215" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="BOXPostItText">
{nome}
<br />
{data}
<br />
{conteudo}
</td>
</tr>
<tr align="right">
<td align="right" style="padding:1px;">
<button type='button' alt='Excluir' class='excluir' onClick='excluir({id})'></button>
</td>
</tr>
</table>
</div>
</div>
</tpl>
</Html>
</ext:XTemplate>
<ext:Panel ID="Panel1" runat="server" Border="false" Padding="10">
<Listeners>
<Render Handler= "#{TplComentario}.overwrite(this.body, #{ObjHolderComentario}.notas);" />
</Listeners>
<LoadMask Msg="Carregando..." ShowMask="true" />
</ext:Panel>
</form>
</body>
</html>
You can run this example.Any suggestion?
Thanks in advance.
Last edited by Daniil; Oct 23, 2011 at 5:19 PM.
Reason: [CLOSED]