Script Manager in MasterPage but does not work correctly

0

On the page that I'm modifying, there was already a modal modalOrgao , and Script Manager was already being used within Master Page . This modal loads a gridview with its results, so that's fine ... But a change appeared and it was necessary to call a new modal (modalDetail) with another gridview (all inside an UpdatePanel) So the problem arises!

How is this new modal called?

Inside a gridview there is a button that when clicking loads information. The modal is created the information is processed, and before it is presented in the modal, the whole page does postback and consecutively the modal some and the information is not presented. The modalOrgao , it continues with its correct operation, does not postback on the page and only, in the area designated to the modal.

I do not know if I passed the information correctly.

Thank you in advance!

Here's a piece of my MasterPage :

<form id="form1" runat="server" autocomplete="off" class="formValidation">
<asp:ScriptManager id="ScriptManager1" runat="server"></asp:ScriptManager>
<uc1:barraTopo ID="barraTopo" runat="server" />
    <div id="container">
        <uc2:cabecalho ID="cabecalho" runat="server" />
            <div id="content">      
                <uc3:menu ID="menu" runat="server" />
                    <div id="main">
                        <asp:Label ID="lblMensagem" runat="server" Text="Mensagem" CssClass="statusRealizado" Visible="false"></asp:Label> 

                        <asp:ContentPlaceHolder id="contentPlaceHolder" runat="server"> </asp:ContentPlaceHolder>

                        <asp:ContentPlaceHolder id="contentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder>

                        <asp:ContentPlaceHolder id="contentPlaceHolder2" runat="server"> </asp:ContentPlaceHolder>
                    </div>
                </div>

           <uc4:rodape ID="rodape" runat="server" />

     </div>
</form>
    
asked by anonymous 18.11.2015 / 12:38

1 answer

0

even if you configure the new drilldown UpdatePanel to be triggered by a button trigger and in Conditional mode?

<asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
    <Triggers>
       <asp:AsyncPostBackTrigger ControlID="Button1" />
    </Triggers>
    <ContentTemplate>
    </ContentTemplate>
</asp:UpdatePanel>

I am giving this alternative but recently I had a problem very similar to yours that I could not solve with UpdatePanel, I ended up bringing the result of the query I wanted using AJAX + JQuery even through a WebMethod that retouches the data in JSON and playing in my new modality. The result was very good and very light, as I had already lost a lot of time with UpdatePanel I decided it was the best solution. It was something like this here:

$.ajax(
{
    type: 'GET',
    url: 'Relatorio.aspx/RetornaListaMedicoes',
    data: { ID: 1 },
    contentType: 'application/json; charset=utf-8',
    dataType: 'json',
    success: function (msg) {
        medicoes = JSON.parse(msg.d);
    }
});

And in the code behind a method:

[WebMethod]
[ScriptMethod(UseHttpGet = true)]
public static string RetornaListaMedicoes(string ID)
{
}

Remembering that ScriptManager needs to be enabled to accept this type of call:

 <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
 </asp:ScriptManager>

Finally, we often can not find the technical solution we needed at the beginning, but we can achieve the same result (or even better) by following another path. I do not wonder how the screen was complex and the modal used a javascript component that I could not easily change, using AJAX to bring the data without needing the Postback saved my day. :)

Hugs

    
29.04.2016 / 15:39