Hi,
I would use AJAX extensions for Visual Studio .NET 2.0 to enhance my website.
I created a MasterPage with 3 contentPlaceHolders, one column on the left for menus, one else on the top for title and one in the middle for the main content. In the the middle ContentPlaceHolder I put an UpdatePanel to refresh only this part of my website. In the UpdatePanel there is a Literal and I try to update the "text" property when the user click on the LinkButtons of the menu. The aim is to load external pages in the middle part as embedded objects without refresh or reload the whole page.
I have got two problems:
1. the whole page is reloaded when I click the first on any LinkButton, but the content of the update panel is well loaded.
2. when I click the second time on an other LinkButton, I've got this error (In French...)
Argument de publication ou de rappel non valide. La validation d'événement est activée via <pages enableEventValidation="true"/> dans la configuration ou via <%@dotnet.itags.org. Page EnableEventValidation="true" %> dans une page. Pour des raisons de sécurité, cette fonctionnalité vérifie si les arguments des événements de publication ou de rappel proviennent du contr?le serveur qui les a rendus à l'origine. Si les données sont valides et attendues, utilisez la méthode ClientScriptManager.RegisterForEventValidation afin d'inscrire les données de publication ou de rappel pour la validation
I tried to find the term "Page EnableEventValidation="true" " in my project but with no success.
But more strange, it works fine on Firefox 2.0. Only the middle part of the page is reloaded, and I've got no error on the second click.
And it is true when I try the tutorials: i.e. the Calendar tutorial, with IE 7 the whole page is reloaded but with Firefox only the UpdatePanel part is reloaded.
Here my code for the UpdatePanel
<div id="M_principal" style="left: 20%; position: absolute; top: 150px; background-color: #ffffcc; width: 80%; height:100%; vertical-align: middle;">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="LinkButton1" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="LinkButton2" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
</ContentTemplate>
</asp:UpdatePanel>
</div>
CodeBehind (C#) :
protected void LinkButton1_Click(object sender, EventArgs e)
{
Literal1.Text = "<object type=\"text/html\" data=\"Page1.aspx?.html\" width=\"1000\" height=\"800\">";
}
protected void LinkButton2_Click(object sender, EventArgs e)
{
Literal1.Text = "<object type=\"text/html\" data=\"Page2.aspx?.html\" width=\"1000\" height=\"800\">";
}
If somebody have an idea to solve this problem...
Thanks.
EventValidation: Go to the @.Page directive at the top of the aspx-file (Source-view).
At the end of the directive, add
EnableEventValidation="false"