Ticket Q578897
Visible to All Users

ASPxGridView inside ASPxPopupControl, don't populating

created 11 years ago

assembly "DevExpress.Web.v11.1 - Version=11.1.8.0"
Problem: 'grdPopLC' go to CustomCallback, return with 4 rows but ASPxGridview show nothing

this call my ASPxPopupControl and populate controls inside him

JavaScript
function btnLancDescritivoConceito_click(ID_A){ popLancDescritivoConceito.Show(); setTimeout(function(){cbpPopLDC_head.PerformCallback(ID_A);},300); setTimeout(function(){cbpDsAvaliacaoDescritiva.PerformCallback(ID_A+';Carregar');},400); setTimeout(function(){grdPopLC.PerformCallback(ID_A + ';Carregar'); }, 500); }

this is my ASPxPopupControl

XAML
<dx:ASPxPopupControl ID="popLancDescritivoConceito" runat="server" ClientInstanceName="popLancDescritivoConceito" Width="950px" MinWidth="450px" MaxWidth="950px" Height="500px" MinHeight="500px" MaxHeight="500px" HeaderText="Descritivo/Conceito" AllowDragging="True" ShowCloseButton="false" CloseAction="None" Modal="True" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" LoadContentViaCallback="OnPageLoad"> <ContentCollection> <dx:PopupControlContentControl ID="popLancDescritivoConceitoContent" runat="server" SupportsDisabledAttribute="false"> <div id="popLDC_head" runat="server" style="float:none;"> <dx:ASPxCallbackPanel ID="cbpPopLDC_head" runat="server" ClientInstanceName="cbpPopLDC_head"> <PanelCollection> <dx:PanelContent> <div style="float:left;"> <asp:Label ID="popLDC_lblNmPessoa" runat="server" Width="100%" Font-Size="Medium"></asp:Label> </div> <div style="float:left;"> <asp:Label ID="popLDC_lblIdAV" runat="server" Visible="false" Enabled="true"></asp:Label> </div> </dx:PanelContent> </PanelCollection> </dx:ASPxCallbackPanel> <img alt="popLDC_div_head" src="..somewhere" width="100%" /> </div> <div id="popLDC_body_R" runat="server" style="width:500px;margin:12px;float:left;"> <label id="lblDsAvaliacaoDescritiva" runat="server" style="width:100%;height:10px;text-align:left;">Descrição:</label> <dx:ASPxCallbackPanel ID="cbpDsAvaliacaoDescritiva" ClientInstanceName="cbpDsAvaliacaoDescritiva" runat="server"> <PanelCollection> <dx:PanelContent ID="cbpDsAvaliacaoDescritivaContent" runat="server"> <dx:ASPxMemo ID="memoDsAvaliacaoDescritiva" runat="server" ClientInstanceName="memoDsAvaliacaoDescritiva" AutoPostBack="false" Width="100%" Height="400px"> </dx:ASPxMemo> </dx:PanelContent> </PanelCollection> </dx:ASPxCallbackPanel> </div> <div id="popLDC_body_L" runat="server" style="width:400px;float:left;padding-top:26px;"> <dx:ASPxGridView ID="grdPopLC" ClientInstanceName="grdPopLC" runat="server" KeyFieldName="ID_B" ViewStateMode="Disabled"> <Columns> <dx:GridViewDataTextColumn FieldName="ID_B" Visible="false" VisibleIndex="-1" ReadOnly="true" ShowInCustomizationForm="true"> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn Caption="Pergunta" FieldName="DS_B" Width="350px" ShowInCustomizationForm="True" VisibleIndex="0" ReadOnly="true" > <Settings AllowDragDrop="False" AllowSort="False" AllowGroup="False" AllowHeaderFilter="False" /> <CellStyle HorizontalAlign="Left" Wrap="true"> </CellStyle> </dx:GridViewDataTextColumn> <dx:GridViewDataTextColumn Caption="Conceito" FieldName="ID_C" Visible="true" VisibleIndex="1"> </dx:GridViewDataTextColumn> </Columns> </dx:ASPxGridView> </div> <div runat="server" style="width:100%;float:left;"> <img alt="popLDC_div_btn" src="..somewhere" width="100%" /> <div style="margin:5px;float:right;"> <div style="float:left;margin:5px;"> <dx:ASPxButton ID="btnPopLDC_confirmar" ClientInstanceName="btnPopLDC_confirmar" runat="server" Text="Confirmar" ToolTip="Confirmar conceito/descrição" Width="100px" AutoPostBack="false"> <ClientSideEvents Click="function(s,e){cbpDsAvaliacaoDescritiva.PerformCallback('Salvar'); grdPopLC.PerformCallback('Salvar');popLancDescritivoConceito.Hide();}" /> </dx:ASPxButton> </div> <div style="float:left;margin:5px;"> <dx:ASPxButton ID="btnPopLDC_cancelar" ClientInstanceName="btnPopLDC_cancelar" runat="server" Text="Cancelar" ToolTip="Cancelar edição" Width="100px" AutoPostBack="false"> <ClientSideEvents Click="function(s,e){cbpDsAvaliacaoDescritiva.PerformCallback('Cancelar');grdPopLC.PerformCallback('Cancelar');popLancDescritivoConceito.Hide();}" /> </dx:ASPxButton> </div> </div> </div> </dx:PopupControlContentControl> </ContentCollection> </dx:ASPxPopupControl>

The ASPxGridView 'CustomCallback' final

C#
var anonLst = from DataRow eRow in Tabela.Rows where eRow["ID_A"] != DBNull.Value && Convert.ToInt32(eRow["ID_A"]) == idAV select new{ idFAPV = eRow["ID_B"] != DBNull.Value ? Convert.ToInt32(eRow["ID_B"]) : 0, dsFAP = eRow["DS_B"] != DBNull.Value ? eRow["DS_B"].ToString() : string.Empty, idFACV = eRow["ID_C"] != DBNull.Value ? Convert.ToInt32(eRow["ID_C"]) : 0 }; DataTable repositorio; repositorio = new DataTable("Table_name"); repositorio.Columns.Add(new DataColumn("ID_B", typeof(int))); repositorio.Columns.Add(new DataColumn("DS_B", typeof(string))); repositorio.Columns.Add(new DataColumn("ID_C", typeof(int))); foreach (var item in anonLst) { repositorio.Rows.Add(item.idFAPV, item.dsFAP, item.idFACV); } repositorio.AcceptChanges(); grdPopLC.DataSource = repositorio; grdPopLC.DataBind();

At 'grdPopLC.DataSource = repositorio;', repositorio has data, 4 rows, but on client nothing appear

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hi,
It looks like your data-binding logic is not correct. You need to rebind the grid to data on every page request (e.g., see ASPxGridView - How to bind to multiple data sources). Please examine the Why might paging (sorting, grouping, filtering) not work in the ASPxGridView? KB article to learn more.
The grid should be bound to data on every page request regardless of the technique that is used to prepare data for the grid. Hence, bind the grid to data unconditionally in the Page_Init or Page_Load event handler. If this does not help you, please provide us with a compilable project so that we can compile and debug it locally. This should help us narrow down the problem faster. Thank you for your time and cooperation in advance.
See Also:
ASPxGridView loses data after a callback
Thanks,
Alessandro.

    Other Answers

    created 11 years ago (modified 11 years ago)

    Google translate
    {
    The method that assigned value to Grid had a bool variable that verified the success of the operation. After performing the operation the variable was not set to value 'true' and was assigned DataSource to null
    }

    sry for time waste

      Comments (1)
      DevExpress Support Team 11 years ago

        Hi,
        Based on your comment, I believe the issue has been resolved. Thank you for sharing your findings with us.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.