Sunday, March 11, 2012

Looks to me as though a full postback is occurring

Put your gridview inside the updatepanel and the button lists outside the updatepanel.

use the Triggers from the updatepanel to trigger those button lists.

<asp:UpdatePanel ID="Test" UpdateMode="Conditional" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" />
</Triggers>
<ContentTemplate>
<asp:GridView ... .../>
</ContentTemplate>
</asp:UpdatePanel>


I have the exact same problem, even when using an extremely simple test page. I'll have a button and label inside the updatepanel, and a label outside. The external label has its text set to the current date and time when the page loads, the label inside is set when the button is pressed. Unfortunately pressing the button sets both labels to the current time.

Now, this is ONLY happening on an upgrade ASP.NET 2.0 project. If i create a new Ajax-enabled project from scratch the exact same test works without issue.
I have followed every tutorial on adding ajax functionality to existing asp.net projects to the letter and i still haven't had any luck.


Atom:

I have the exact same problem, even when using an extremely simple test page. I'll have a button and label inside the updatepanel, and a label outside. The external label has its text set to the current date and time when the page loads, the label inside is set when the button is pressed. Unfortunately pressing the button sets both labels to the current time.

Now, this is ONLY happening on an upgrade ASP.NET 2.0 project. If i create a new Ajax-enabled project from scratch the exact same test works without issue.
I have followed every tutorial on adding ajax functionality to existing asp.net projects to the letter and i still haven't had any luck.

And I just solved my own problem. It seems that a copy-paste of everything in the test app's web.config to overwrite the current web.config was not enough. I had to delete the original web.config from my project and create a new one, then paste the test application's web.config into that. Now it works fine.


Aeries, I didn't know about the trigger collection of the update panel. I've got 2 radio button list controls on the page, both of which I want to cause a fetching of data from the service and updating it in the gridview controlvia AJAX. So, I've put both of those in and set the event to be SelectedIndexChanged. However, it still doesn't seem to be working - i.e.: the postbacks are still occurring. I know this because I've put a label onto the page to display the time, which gets updated when a postback occurs, and is outside of the scope of the update panel control.

Any ideas, as to what I might be doing wrong, now?


Atom:

Atom:

I have the exact same problem, even when using an extremely simple test page. I'll have a button and label inside the updatepanel, and a label outside. The external label has its text set to the current date and time when the page loads, the label inside is set when the button is pressed. Unfortunately pressing the button sets both labels to the current time.

Now, this is ONLY happening on an upgrade ASP.NET 2.0 project. If i create a new Ajax-enabled project from scratch the exact same test works without issue.
I have followed every tutorial on adding ajax functionality to existing asp.net projects to the letter and i still haven't had any luck.

And I just solved my own problem. It seems that a copy-paste of everything in the test app's web.config to overwrite the current web.config was not enough. I had to delete the original web.config from my project and create a new one, then paste the test application's web.config into that. Now it works fine.

Atom, have you any idea what it is that is different with your "new" Web.Config file?


Who,

try creating a new Ajax Website and see if this problem still occurs. If yes, then probably there's something missing in your web.config file. if it doesn't work, paste your html and code behind here so i'll check it out. Cheer.


DoctorWho:

Atom:

Atom:

I have the exact same problem, even when using an extremely simple test page. I'll have a button and label inside the updatepanel, and a label outside. The external label has its text set to the current date and time when the page loads, the label inside is set when the button is pressed. Unfortunately pressing the button sets both labels to the current time.

Now, this is ONLY happening on an upgrade ASP.NET 2.0 project. If i create a new Ajax-enabled project from scratch the exact same test works without issue.
I have followed every tutorial on adding ajax functionality to existing asp.net projects to the letter and i still haven't had any luck.

And I just solved my own problem. It seems that a copy-paste of everything in the test app's web.config to overwrite the current web.config was not enough. I had to delete the original web.config from my project and create a new one, then paste the test application's web.config into that. Now it works fine.

Atom, have you any idea what it is that is different with your "new" Web.Config file?

That's the thing - there was no difference as far as i could tell.

One thing I forogt to mention - my existing asp.net application didn't have some of the same references given to a new AJAX project. I had to manually add those as well. After some testing i found out that just the web.config change, or just adding the references, did not fix the problem.


Atom, what are those references that you had to add to your project, that would now be added to an AJAX project?


OK, I finally got it working with the help ofTim Heuer, a Technical Evangelist for Microsoft. (Thanks, Tim!!!) Also, I might add that I was getting an error in IE when I went to the web page in question. The error was'Sys' is undefined.

Anyway, Tim pointed me to anexcellent online learning video by Joe Stagner, which describes bringing up to speed ASP.NET apps which were created in without ASP.NET AJAX. Note: it required a substantial amount of editing of the Web.Config file, and I also included a reference to System.Web.Extensions namespace. What I did was created a barebones ASP.NET AJAX website, so that I could copy-and-paste from its Web.Config file to my Intranet Web.Config file.

I hope that this helps.

No comments:

Post a Comment