[CLOSED] UpdatePanel not refresh

  1. #1

    [CLOSED] UpdatePanel not refresh

    Hello Fabricio:
    I have the next piece of code in coolite:
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <ext:TabPanel ID="tabDepositos" runat="server" Height="830px" ActiveTabIndex="0"
                    DeferredRender="false">
                    <Tabs>
                        <ext:Tab ID="tab1" runat="server" Icon="Basket" Title="Depositos">
                            <Body>
                                <ext:BorderLayout ID="BorderLayout1" runat="server">
                                    <Center>
                                        <ext:Panel runat="server" ID="pnlCaja2" Title="Depositos encontrados" Icon="Basket">
                                            <Body>
                                                <table class="Modulo_Tony" width="99%">
                                                    <tr>
                                                        <td colspan="3">
                                                            <asp:GridView ID="gvDepo" runat="server" CssClass="grid" AllowPaging="True" DataSourceID="SqlDepo">
                                                                <SelectedRowStyle CssClass="selectedrow"></SelectedRowStyle>
                                                                <AlternatingRowStyle CssClass="altrowstyle"></AlternatingRowStyle>
                                                                <Columns>
                                                                    <asp:CommandField SelectText="Detalle" ShowSelectButton="True"></asp:CommandField>
                                                                </Columns>
                                                                <EmptyDataTemplate>
                                                                    <span style="font-size: 9pt; color: #cc3300; font-family: Verdana">No existen depositos
                                                                        creados.</span>
                                                                </EmptyDataTemplate>
                                                                <PagerStyle CssClass="pagerstyle"></PagerStyle>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                                <asp:SqlDataSource ID="SqlDepo" runat="server"></asp:SqlDataSource>
    
                                                <ext:Panel ID="pnlPolizas" runat="server" Title="Pólizas relacionadas" Visible="false">
                                                    <Body>
                                                        <table class="Modulo_Tony" width="99%">
                                                            <tr>
                                                                <td colspan="3">
                                                                    <asp:GridView ID="gvDepoPol" runat="server" CssClass="grid" AllowPaging="True" DataSourceID="SqlDepoPol"
                                                                        OnSelectedIndexChanged="gvDepoPol_SelectedIndexChanged">
                                                                        <Columns>
                                                                            <asp:CommandField SelectText="Asignar" ShowSelectButton="True"></asp:CommandField>
                                                                        </Columns>
                                                                        <EmptyDataTemplate>
                                                                            <span style="font-size: 9pt; color: #cc3300; font-family: Verdana">No se encuentra polizas
                                                                                relacionadas.</span>
                                                                        </EmptyDataTemplate>
                                                                        <SelectedRowStyle CssClass="selectedrow"></SelectedRowStyle>
                                                                        <PagerStyle CssClass="pagerstyle"></PagerStyle>
                                                                        <AlternatingRowStyle CssClass="altrowstyle"></AlternatingRowStyle>
                                                                    </asp:GridView>
                                                                </td>
                                                            </tr>
                                                             .....
    The code-behind is:
        Protected Sub gvDepo_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvDepo.SelectedIndexChanged
            cargaDepoPol()
        End Sub
        Public Sub cargaDepoPol()
            Dim sql As String
            sql = "SELECT adpoliza.cramo AS CRamo, rtrim(maramos.xdescripcion_l) AS Ramo, adpoliza.cnpoliza AS Póliza, adpoliza.cpoliza AS CPol, adpoliza.fanopol AS AnoPol, adpoliza.fmespol AS MesPol, CONVERT(CHAR(10),adpoliza.fdesde,101) AS FInicial, CONVERT(CHAR(10),adpoliza.fhasta,101) AS FFinal,"
            sql += " adpoliza.ctenedor AS CTenedor, rtrim(maeTene.xcliente) AS Tenedor, adpoliza.casegurado AS CAseg, rtrim(maeAseg.xcliente) AS Asegurado"
            sql += " FROM (((adpoliza INNER JOIN maentes maeTene ON adpoliza.ctenedor = maeTene.cci_rif)"
            sql += " INNER JOIN maentes maeAseg ON adpoliza.casegurado = maeAseg.cci_rif)"
            sql += " INNER JOIN maramos ON adpoliza.cramo = maramos.cramo)"
            sql += " WHERE adpoliza.ctenedor = " & gvDepo.Rows(gvDepo.SelectedIndex).Cells(3).Text
            SqlDepoPol.ConnectionString = Vg.ConnectionStringMundisis
            SqlDepoPol.SelectCommand = sql
            SqlDepoPol.DataBind()
            gvDepoPol.AllowPaging = False
            gvDepoPol.DataBind()
            gvDepoPol.Caption = "Registros (" & gvDepoPol.Rows.Count & ")"
            gvDepoPol.AllowPaging = True
            pnlPolizas.Visible = True
        End Sub
    The idea is that i have a master-detail structure with the GridView gvDepo like Master and the GridView gvDepoPol like detail. Initially the second panel (pnlPolizas) is not visible like show you in this picture.
    Click image for larger version. 

Name:	UpdatePanel 1.png 
Views:	68 
Size:	33.3 KB 
ID:	25198
    When click the column <detalle> the script <gvDepo_SelectedIndexChanged> is trigered. And the second gridview turn visible and the gridview is populated. Like the next screen show.
    Click image for larger version. 

Name:	UpdatePanel 2.png 
Views:	55 
Size:	49.6 KB 
ID:	25199
    I rewrite the next code for Ext.Net 4:
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
        <ext:ResourceManager runat="server" />
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <ext:TabPanel ID="tabDepositos" runat="server" Height="830px" ActiveTabIndex="0"
                    DeferredRender="false">
                    <Items>
                        <ext:Panel ID="tab1" runat="server" Icon="Basket" Title="Depositos"
                            layout="BorderLayout">
                            <Items>
                                <%--<ext:BorderLayout ID="BorderLayout1" runat="server">
                                    <Center>--%>
                                        <ext:Panel runat="server" ID="pnlCaja2" Title="Depositos encontrados" Icon="Basket"
                                            region="Center">
                                            <Content>
                                                <table class="Modulo_Tony" width="99%">
                                                    <tr>
                                                        <td colspan="3">
                                                            <asp:GridView ID="gvDepo" runat="server" CssClass="grid" AllowPaging="True" DataSourceID="SqlDepo"
                                                                OnSelectedIndexChanged="gvDepo_SelectedIndexChanged">
                                                                <SelectedRowStyle CssClass="selectedrow"></SelectedRowStyle>
                                                                <AlternatingRowStyle CssClass="altrowstyle"></AlternatingRowStyle>
                                                                <Columns>
                                                                    <asp:CommandField SelectText="Detalle" ShowSelectButton="True"></asp:CommandField>
                                                                </Columns>
                                                                <EmptyDataTemplate>
                                                                    <span style="font-size: 9pt; color: #cc3300; font-family: Verdana">No existen depositos
                                                                        creados.</span>
                                                                </EmptyDataTemplate>
                                                                <PagerStyle CssClass="pagerstyle"></PagerStyle>
                                                            </asp:GridView>
                                                        </td>
                                                    </tr>
                                                </table>
                                                <asp:SqlDataSource ID="SqlDepo" runat="server"></asp:SqlDataSource>
    
                                                <ext:Panel ID="pnlPolizas" runat="server" Title="Pólizas relacionadas" Visible="false"
                                                    region="Center">
                                                    <Content>
                                                        <table class="Modulo_Tony" width="99%">
                                                            <tr>
                                                                <td colspan="3">
                                                                    <asp:GridView ID="gvDepoPol" runat="server" CssClass="grid" AllowPaging="True" DataSourceID="SqlDepoPol"
                                                                        OnSelectedIndexChanged="gvDepoPol_SelectedIndexChanged">
                                                                        <Columns>
                                                                            <asp:CommandField SelectText="Asignar" ShowSelectButton="True"></asp:CommandField>
                                                                        </Columns>
                                                                        <EmptyDataTemplate>
                                                                            <span style="font-size: 9pt; color: #cc3300; font-family: Verdana">No se encuentra polizas
                                                                                relacionadas.</span>
                                                                        </EmptyDataTemplate>
                                                                        <SelectedRowStyle CssClass="selectedrow"></SelectedRowStyle>
                                                                        <PagerStyle CssClass="pagerstyle"></PagerStyle>
                                                                        <AlternatingRowStyle CssClass="altrowstyle"></AlternatingRowStyle>
                                                                    </asp:GridView>
                                                                </td>
                                                            </tr>
                                                            .....
    Is basically the same code except changing the layout, region and tab.
    The code-behind is the same.
    I have the problem that when i click the column <detalle> the page is not updated and show a Blank page when in coolite refresh the panel and show the second grid and populate it.
    It's exactly the same code so i think something in Ext.Net 4 is different and for this reason doesn´t update correctly. Some idea?

    Thanks for the patience.
    Regards
    Last edited by fabricio.murta; Dec 18, 2018 at 8:38 PM.
  2. #2
    Hello. Support for the asp:UpdatePanel was dropped a long time ago. Any Ext.NET components inside an UpdatePanel are likely to not function as expected. Unfortunately, there's nothing we're going to be able to do if an UpdatePanel is involved on the page.
    Geoffrey McGill
    Founder
  3. #3

    Some recomendations

    Hello:

    Thanks for your answer.
    Do you have some recomendation or some examples to do something with the same function?

    Have a nice day
  4. #4
    Hello @devSF!

    Sorry for the long delay to reply your inquiry! I believe the ASP:UpdatePanel could be replaced for something similar we discussed in the other thread? When it was up in discussion around, I did not really find anybody share in the threads they opened what they switched to instead of it.

    I'm thinking about partial views, or just re-filling a panel.

    For example, if that's grid panel, you can just call its load() method again, so it pulls -just- the data from the server something, for example you have in this example: Grid Panel - Remote Load.

    Which should be faster than loading and formatting the full component.

    It really boils down to the exact goal you want to achieve. As I see by your lines of code, your queries involves sql queries, so I believe the example above would pretty much open the way to the path you need to follow in your example.

    We already discussed one alternative of having the "load" button being auto-clicked in our other thread.

    Something else that might be even closer to the approach you been used to would be the concept of tasks. Take a look on this example, it polls a query to the server, updating the page continuously.

    In this example, it showcases the feature by updating the "busy mask" in the server, but updating a panel would also be possible.

    In your example, it looks like you just use a panel to wrap a grid view; it really looks like this should evolve to a GridPanel or GridView Ext.NET components, rather than keeping the legacy ASP approach.

    There should not be any problem keeping it to the point of view of technology -- but layout wise, this is likely to become a problem. So it really looks like this page should be worked up to use full Ext.NET capability instead of relying in ASP's GridView + UpdatePanel.

    I hope the explanation above is clear, but should take some effort to get up to speed with that change in approach. Please carefully review some GridPanel examples, and I'm sure you'll find one that you could start with to refactor your page with.

    I believe once you wrap up in a model to follow, that best suits you, we could then help you with issues, like updating the panel dynamically, and anything else that raises up.

    Hope this helps!
    Fabrício Murta
    Developer & Support Expert
  5. #5
    Hello again, @DevSF!

    Have you been able to figure a way out of the UpdatePanel already, or do you still need help on this thread? It's been a while since we posted here and you didn't post back. While unfortunately we can't support the ASP UpdatePanel, we're sure there are better approaches to it that would make your application even better!

    We may mark this thread as 'closed', given you don't provide a follow-up in 7+ days from now. When we mark a thread as closed, we don't lock it up, so you'd still be able to post here whenever you feel fit; just maybe we'd need a nudge to notice the update in the thread as when it is closed sometimes updates to it are missed.

    Looking forward to your follow-up!
    Fabrício Murta
    Developer & Support Expert
  6. #6

    You can close

    Hi Fabricio:

    Thanks for your help.
    In this moment my focus is in another part of the migration process. You can close the thread if i need something later i will ask again.
    Have a nice day.
  7. #7
    Okay, @devSF! Thanks for the feedback, we are here to help if you need!
    Fabrício Murta
    Developer & Support Expert

Similar Threads

  1. Replies: 1
    Last Post: Dec 10, 2013, 10:57 AM
  2. Replies: 3
    Last Post: Feb 12, 2013, 9:01 AM
  3. Replies: 2
    Last Post: Jan 22, 2012, 2:00 PM
  4. Replies: 0
    Last Post: Sep 22, 2009, 3:52 PM
  5. UpdatePanel
    By Timothy in forum Bugs
    Replies: 2
    Last Post: Mar 03, 2009, 8:48 AM

Tags for this Thread

Posting Permissions