Script Manager on Masterpage but not working correctly

Asked

Viewed 398 times

0

On the page I’m changing there was already a modal modalOrgao, and was already being used the Script Manager within the Master Page. This modal carries a gridview with its results, so far so good... But there arose a change and it was necessary to call a new modal (modal Design) with another gridview (all within an Updatepanel) There arises the problem!

As this new modal is called?

Within a gridview There is a button that clicks information. The modal is created the information is processed, and before it is presented in the modal, the whole page does the postback and consecutively the modal disappears and the information is not presented. The modalOrgao, it continues with its correct functioning, does not do the postback on the page and yes only in the area designated to the modal.

I don’t know if I passed the information correctly.

Thanks in advance!

Follow a piece of mine 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>
  • It’s not [tag:Asp.net]?

  • Yes it is Asp.net.!

1 answer

0


even configuring the new Updatepanel detailing to be trigger through a button rigger and in Conditional mode?

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

I’m giving this alternative but recently I had a problem very similar to yours that I couldn’t solve with Updatepanel, I ended up bringing the result of the query I wanted using AJAX + Jquery even through a Webmethod that resumes the data in JSON and playing in my new modal. The result was very good and very light, as I had already lost a lot of time with Updatepanel I decided that 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 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, many times we could not find the technical solution we needed in the beginning but it is possible to achieve the same result (or even better) by following another path. In my case as the screen was complex and the modal used a javascript component that I could not easily change, use AJAX to bring the data without needing Postback saved my day. :)

Hugs

  • Even answered after a certain time the answer is correct! I did the same thing you suggested at the time. Thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.