Feb 08

Erreur de ce type : "Uncaught Sys.InvalidOperationException: Sys.InvalidOperationException: Could not find UpdatePanel" :

"Uncaught Sys.InvalidOperationException: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'ctl00_updxxx'. If it is being updated dynamically then it must be inside another UpdatePanel."

Si vous rencontrez cette erreur c'est que vous tentez de masquer (Visible = false) un panel qui contient un update panel. Ou de mettre a jour un update panel qui est dans un panel avec l'attribut visible = false

Deplacer le panel dans l'update panel et ce sera bon !

<asp:UpdatePanel runat="server" ID="updXXX" UpdateMode="Conditional">

            <ContentTemplate>

                <asp:Panel runat="server" ID="pnlXXX" Visible="false">

                          CONTENT

                </asp:Panel>

            </ContentTemplate>

</asp:UpdatePanel>

 

Tags:
Feb 08

Voici le moyen de rendre persistant un view state lors de différents postback au sein de la meme page :

public string TheProperty

{

get

    {

string text = (string)ViewState["TheProperty"];

if (text != null)

return text;

else

return string.Empty;

}

set

{

ViewState["TheProperty"] = value;

}

}

 
Tags: