Login hidden and updatePanel (ASP.NET AJAX history)

How can I update the input hidden inside the UpdatePanel on the AsyncPostBack?

The user clicks a button outside the panel. The method associated with the click event updates the input value (has a runat = "server" property).

I cannot update the value of this input.

I need to store the value for use in the next postback. Perhaps I can use a session to store this value.

Any advice?

Thanks!

0


a source to share


4 answers


In no case. The only way to update the input is to make a complete post. Better to use the Session object.



0


a source


Since its postback, you might have to check in the post back event and do an update. If not, you may need to override the previous event. See http://msdn.microsoft.com/en-us/library/dct97kc3.aspx



0


a source


If you need to update the refresh panel (and its contents) based on a user click on a button that is not on the refresh bar, add a section to the refresh bar as shown below:

<asp:Button ID="btnOK" runat="server"/> 
<asp:UpdatePanel ID="pnlMyPanel" runat="server">
    <ContentTemplate>
        <!-- Content to get updated -->
    </ContentTemplate>
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnOK" />
    </Triggers> 
</asp:UpdatePanel>

      

The triggers section in the example above says to update the refresh panel if a button is clicked.

0


a source


You might want to try <asp:HiddenField>

instead <input type='hidden' runat='server'>

. I think the asp.net version is more post-back aware.

0


a source







All Articles