Sep 01, 2015, 4:52 PM
[CLOSED] render dynamic control
I load information from a control and add to panel , in a precise moment, i need to load more information / more controls . The controls generated after the click of the button, doesn't appear on the screen , the UpdateContent not worked.
How can I render these controls without reloading the page ?
How can I render these controls without reloading the page ?
protected void Page_Load(object sender, EventArgs e)
{
this.hdnQtdOcorrencia.Value = Convert.ToInt32(this.hdnQtdOcorrencia.Value) == 0 ? 10 : this.hdnQtdOcorrencia.Value;
this.carregarOcorrencias();
}
protected void carregarOcorrencias()
{
int tamanhoDt = Convert.ToInt32(this.hdnQtdOcorrencia.Value);
ocorr.qtdOcorrencia = tamanhoDt;
dt = ocorr.buscarOcorrencias();
if (tamanhoDt <= 10)
{
dtTake = dt.Rows.Cast<DataRow>().OrderByDescending(x => x["OC_ID"]).ToList();
}
else
{
dtTake = dt.Rows.Cast<DataRow>().OrderByDescending(x => x["OC_ID"]).Skip(tamanhoDt - 10).ToList();
}
foreach (var row in dtTake)
{
CONTROLS_ocorrenciasMural c = (CONTROLS_ocorrenciasMural)this.LoadControl("~/CONTROLS/ocorrenciasMural.ascx");
c.setValues(row);
Ext.Net.Hyperlink nOcorrencia = (Ext.Net.Hyperlink)c.FindControl("hypVisualizar");
c.ID = "control" + nOcorrencia.Text;
this.panelOcorrencias.ContentControls.Add(c);
//this.panelOcorrencias.UpdateContent();
}
}
<ext:hidden runat="server" ID="hdnQtdOcorrencia"></ext:hidden>
<ext:Panel ID="panelOcorrencias" runat="server" Region="Center" Flex="5" OverflowY="Auto" Border="false" Frame="false" Layout="VBoxLayout">
<LayoutConfig>
<ext:VBoxLayoutConfig Align="Center"></ext:VBoxLayoutConfig>
</LayoutConfig>
</ext:Panel>
<ext:Button runat="server" UI="Primary" Text="Mais Ocorrências" AutoLoadingState="true">
<Listeners>
<Click Handler="App.direct.onClickMaisOcorrencias(#{hdnQtdOcorrencia}.getValue());"></Click>
</Listeners>
</ext:Button>
public void onClickMaisOcorrencias(int qtdOcorrencia)
{
this.hdnQtdOcorrencia.Value = qtdOcorrencia + 10;
this.carregarOcorrencias();
}
Last edited by Daniil; Sep 11, 2015 at 12:27 PM.
Reason: [CLOSED]