Page view counter

AJAX issue: you may need a manadatory UpdatePanel

Last post 03-02-2009 8:11 AM by azizkap1269. 10 replies.

Sort Posts:

  • AJAX issue: you may need a manadatory UpdatePanel

    09-15-2006, 4:50 PM
    • Loading...
    • Russ Helfand
    • Joined on 09-14-2005, 6:22 PM
    • Groovybits.com
    • Posts 741
    • Points 3,298

    Several people have reported on this forum (and to me privately) when using the CSS friendly adapters in a site that also uses the Microsoft AJAX Library (aka Atlas).  First, please let me apologize for the inconvenience that this has caused.  Let's get right to the task of figuring out how to deal with it in a practical sense.

    Some of you who are plugged into the AJAX world know of a really bright guy by the name of Eilon Lipton.  He's part of the Microsoft team that's developing the Microsoft AJAX Library.  He and I exchanged some email, some files and some good karma brainstorming about this.

    We came up with a pretty simple recipe to duplicate the problem that we think folks are running into. And then we developed what we think is a decent work around. I'll describe both of these things in a moment.  Please understand that it is entirely possible that there are multiple problems integrating the Microsoft AJAX Library with these adapters.  We'll try to figure out solutions (work arounds) for each of these as we learn about them.  So, if what I propose below doesn't work for you, please let me know and we'll look into your case further.

    OK, the test case we used was made this way:

    1. Installed the beta 2.0 version of the CSS friendly adapter kit (http://www.asp.net/cssadapters).
    2. Create a new web site from VS or VWD.  Chose the Tutorial on CSS... as the web site template.
    3. Added the July CTP version of Microsoft.Web.Atlas.dll to the bin folder.
    4. Added this to my site's web.config's system.web section:
      <pages>
        <controls>
          <add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
          <add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
        </ controls>
      </ pages>
    5. Modified my GridView.aspx page so its LiveExample content was this:
      <asp:Content runat="server" ContentPlaceHolderID="LiveExample">
        <atlas:scriptmanager id="ScriptManager" runat="server" enablepartialrendering="true" />
          <div id="SampleGridView">
            <p>
              What happens when we run the Math methods over and over again? Here are some raw timing statistics.
            </p>
            <asp:GridView runat="server" id="GridView1" CssSelectorClass="PrettyGridView" SkinID="SampleGridView" DataSourceID="MathOperationPerfDS" AllowPaging="true" AllowSorting="true" PageSize="10" AutoGenerateColumns="false" OnRowCreated="DoRowCreated" OnSelectedIndexChanged="OnSelectedIndexChanged" AutoGenerateSelectButton="true">
              <pagersettings Position="TopAndBottom" />
                <columns>
                  <asp:BoundField DataField="Operation" SortExpression="Operation" HeaderText="Operation" />
                  <asp:BoundField DataField="Reps" SortExpression="Reps" HeaderText="Repetitions" />
                  <asp:BoundField DataField="Duration" SortExpression="Duration" HeaderText="Total test duration milliseconds" />
                  <asp:BoundField DataField="Average" SortExpression="Average" HeaderText="Average cost per rep microseconds" DataFormatString="{0:F4}" HtmlEncode="false" />
                </columns>
              </asp:GridView>
          </div>
          <asp:ObjectDataSource runat="server" id="MathOperationPerfDS" selectMethod="Fetch" typename="MathOperationPerf" />
      </asp:Content>
    6. Added this function to the code-behind file GridView.aspx.cs:
      protected void OnSelectedIndexChanged(object sender, EventArgs e) { }
    7. Debug or run the modified GridView.aspx page from VWD or VS.
    8. Click "select" any row of the grid. This causes a client-side message box to appear that says "Unknown Error" and presents and OK button.

    With help from some of the folks who originally reported the problem we found :

    1. The problem vanishes if EnablePartialRendering is false in the script manager.  This is consistent with what Rosdi reported for his issue.
    2. The problem vanishes if you wrap the GridView tag with <atlas:UpdatePanel runat="server" ID="foobar"><ContentTemplate> and close these tags properly after the GridView tag closes.
    3. The problem vanishes if the Atlas scriptmanager tag is removed (and, of course, you don’t have any updatepanel).

    From this (and his access to the Atlas source), Eilon was able to determine what is going on.

    The exact sequence of internal events is a bit more than I want to get into here.  Suffice it to say that some future fixes in the final release of the Microsoft AJAX Library and/or changes in the adapter kit will eventually eliminate this problem.  Meanwhile, though, I want folks to have a decent way to work around it.

    Eilon suggested a great fix that will work for many people: add a superfluous UpdatePanel to the problematic pages.  Let me explain...

    In the modified GridView.aspx page described earlier in this posting you added an <atlas:ScriptManager>.  You could add this seemingly benign UpdatePanel immediately after it:

    <atlas:UpdatePanel id="MandatoryUpdatePanel" runat="server"><ContentTemplate></ContentTemplate></atlas:UpdatePanel>

    Notice that its Content template is empty and it isn't really used anywhere on the page.  Still, it is enough to prevent the "Unknown Error" problem from happening!

    Some people may have run into this because they added an <atlas:ScriptManager> tag in a master page.  So all pages don't have any UpdatePanel could run into the "Unknown Error" problem, particularly if they are set up to use an adapted GridView that posts back (via a select button/link or by other means). In that case, you may find it convenient to simply add this benign MandatoryUpdatePanel in the master page, too, just below the <atlas:ScriptManager>.

    Obviously, this is just a work around.  As I said, I believe fixes in the Microsoft AJAX Library and perhaps in the kit will eliminate the need for this sort of hack in the future.  For now, though, some folks may find this useful.

    If you still have problems with the adapters + AJAX please:

    1. Make certain that the problem vanishes if you don't use the adapters.  You can test this by temporarily deleting the files in your web site's App_Browser folder.
    2. Try disabling partitial rendering in AJAX by setting EnablePartialRendering="false" in the <atlas:ScriptManager> tag in your page (or master page). This isn't a fix but it may be a sufficient work around for some people.
    3. Try adding the benign, empty, madatory UpdatePanel as described below.
    4. If you are still having problems, try to develop a recipe that allows us to reproduce the problem and post it on this forum.

    THANKS and good luck everyone!

    Russ Helfand
    Groovybits.com
  • Re: AJAX issue: you may need a manadatory UpdatePanel

    10-02-2006, 9:42 AM
    • Loading...
    • chunshahab
    • Joined on 07-07-2003, 2:49 PM
    • USA
    • Posts 501
    • Points 2,509

    Hi, Russ,

    I just dived in ASP.NET AJAX and run into this problem. Please help.

    I am using Wizard Control + Validation control + AJAX on my page. I ran into javascript error which prevent the navigation to go forward. After hourse of experimenting, I found that the problem is due to using the Validation control with ASP.NET AJAX (I will show an example later). If I romve the AJAX, everything works fine; if I remove the validation control and put the AJAX back, everything works. fine.

    Sure, I can try to do the validaiton myself rather than using the validation control. But htis is a done project, I am just reying to make it AJAX-enabled and make ths user's expereince better. I am looking for a different workaround rather than remove the validation control.

    Here is the code: as it is, move from step 1 to 2, no problem; move to step 2 to 3, cannot move. status bar shows javascript error. Remove the validation control in step 1, everything works.

    Thanks for your hel in advance.

    <form id="form1" runat="server">

    <div>

    <atlas:ScriptManager ID="sm" EnablePartialRendering="true" runat="server" />

    <atlas:UpdatePanel ID="UpdatePanel1" runat="server">

    <ContentTemplate>

    <asp:Wizard ID="TierXQueryWizard" runat="server" ActiveStepIndex="0" DisplaySideBar="false">

    <WizardSteps>

    <asp:WizardStep ID="AddEdit" runat="server" StepType="Start" Title="Add/Edit Query">

    <div class="PageInstruction" align="center">

    To Create a new query, select "- New -" from the drop-down list, enter a query name and description.

    To Edit an existing query, select the query name from the drop-down list.

    </div>

    <table border="0" width="70%">

    <tr>

    <td nowrap>

    <strong>User E-mail:</strong>

    </td>

    <td>

    <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>

    <asp:RequiredFieldValidator ID="rfvEmail" runat="server" SetFocusOnError="True" ControlToValidate="txtEmail" Display="Dynamic" ErrorMessage="Enter your email address."/>

    </td>

    </tr>

    <tr valign="top">

    <td>

    <strong>Query Name:</strong>

    </td>

    <td nowrap>

    <asp:DropDownList ID="ddlQueryName" runat="server" DataTextField="QUERY_NAME" DataValueField="QUERY_NAME"

    AutoPostBack="True"/>

    <br />

    <asp:TextBox ID="txtQueryName" runat="server" MaxLength="40"></asp:TextBox>

     

    </td>

    </tr>

    <tr valign="top">

    <td><strong>Description:</strong></td>

    <td>

    <asp:TextBox ID="txtDescription" runat="server" TextMode="MultiLine" Columns="30" Rows="5" />

     

    </td>

    </tr>

    </table>

    </asp:WizardStep>

    <asp:WizardStep ID="DeliveryMethod" runat="server" StepType="Step" Title="Delivery Method">

    <div class="PageInstruction" align="center">

    Please select a delivery method. If have selected Scheduled, you are required to select a run frequency.

    </div>

    </asp:WizardStep>

    <asp:WizardStep ID="DataType" runat="server" StepType="Step" Title="Data Type(s)">

    <div class="PageInstruction" align="center">

    To select/unselect the data types, click the checkbox next to the data type. Please select at least one data type.

    </div>

    </asp:WizardStep>

    <asp:WizardStep ID="QueryFilter" runat="server" StepType="Step" Title="Query Filter(s)">

    <div class="PageInstruction" align="center">

    To add a filter, select the filter value from the drop-down list or enter the value into the text box, then click Add button.

    To remove a filter from the listbox, select the filter value by clicking on it and then click the Remove button.

    Product Line filter is not available for On Demand due to the hugh amount of data.

    </div>

    </asp:WizardStep>

    <asp:WizardStep ID="Summary" runat="server" Title="Summary">

    <div class="PageInstruction" align="center">

    Please review your query summay. If you need to make any changes, please use the Previous button to go back.

    </div>

    </asp:WizardStep>

    <asp:WizardStep ID="Complete" runat="server" StepType="Complete" Title="Complete">

    <div align="center">

    <asp:Label ID="lblInfo" runat="server" CssClass="Message"/> <br /><br />

    Click <b>My Query Template</b> at the top to view/edit your exisitng query templates.<br />

    Click <b>My Jobs</b> at the top to view your exisitng jobs.<br />

    Click <b>My Files</b> at the top to view your exisitng download files.<br />

    Click <b>Template Builder</b> at the top to create/edit query template.

    </div>

    </asp:WizardStep>

    </WizardSteps>

    </asp:Wizard>

    <asp:Literal ID="lJavaScript" runat="server" />

    </ContentTemplate>

    </atlas:UpdatePanel>

    </div>

    </form>

     

     

     

     

    Help Whenever You Can
    Live Without Regret
  • Re: AJAX issue: you may need a manadatory UpdatePanel

    10-02-2006, 4:57 PM
    • Loading...
    • Russ Helfand
    • Joined on 09-14-2005, 6:22 PM
    • Groovybits.com
    • Posts 741
    • Points 3,298

    What exactly is the problem you are observing?

    How do ASP.NET adapters fit into this scenario?

     Regards,

    Russ Helfand
    Groovybits.com
  • Re: AJAX issue: you may need a manadatory UpdatePanel

    10-03-2006, 7:01 AM
    • Loading...
    • Osiris209
    • Joined on 02-11-2006, 4:19 PM
    • England
    • Posts 133
    • Points 568

    Hi Russ.

     This doesn't work for me.
    I am using a script manager on a master page, i have tried adding the empty updatepanel to the masterpage and the offending webform and i still get a js error (object expected) when clicking a link button on the gridview (which has the command=select).
    Another problem i have with the empty updatepanel is that is uses space on the page.

    I dont get the error if i turn off partialrendering or dont use the adapter.

    Strange this is that as i said in this thread http://forums.asp.net/thread/1399011.aspx i have pages that have updatepanels and gridviews that work fine.
    On the offending page i have two updatepanels each with a gridview inside.
    I have a cascading drop down control as well thats within another updatepanel.
    One strange thing i notice is that when i view source on the offending page i cannot see the markup for the gridview??? Any reason for this.?

    If you want anymore info please let me know....i really want to use the adapter.
    NOTE: I am using the adapter for a menu control (not the gridviews), the menu is within a WebControl that is within a MasterPage, the scriptmanager is on the masterpage, the gridviews are on a webform.

  • Re: AJAX issue: you may need a manadatory UpdatePanel

    10-03-2006, 5:34 PM
    • Loading...
    • Russ Helfand
    • Joined on 09-14-2005, 6:22 PM
    • Groovybits.com
    • Posts 741
    • Points 3,298

    Have you tried putting the empty UpdatePanel on the master page, not the content (ASPX) page?

    Sorry, but I don't yet have enough info about this problem to dup it or to give you better suggestions.  Ultimately, you might have to post something on the Atlas forums, also, to get help direclty from that team.  They have the Atlas source code; I don't.  So there are limits around how much debugging I can do for this sort of problem.  Further, I don't yet have a reproducible recipe from you.  The code you showed above isn't sufficient.  To make a reproducible recipe you'll need to try to recreate the problem with a much, much simpler set of files, ones that you can then post fully along with instructions of how I can "install" or use them.

    Russ Helfand
    Groovybits.com
  • Re: AJAX issue: you may need a manadatory UpdatePanel

    10-04-2006, 5:56 AM
    • Loading...
    • Osiris209
    • Joined on 02-11-2006, 4:19 PM
    • England
    • Posts 133
    • Points 568

    I have tried putting an empty updatepanel on the master page yes.

    OK, i will try and get some time later to make up a repro recipe.

  • Re: AJAX issue: you may need a manadatory UpdatePanel

    10-04-2006, 11:39 AM
    • Loading...
    • Russ Helfand
    • Joined on 09-14-2005, 6:22 PM
    • Groovybits.com
    • Posts 741
    • Points 3,298

    OK, thanks for letting me know that you tried putting the UpdatePanel on the master page, too. That's one more thing we can eliminate.

    And an especially BIG thanks for agreeing to try to put together a slimmer repro recipe.  If you do that, I'll promise to install it and do some debugging on it to see what I can discover.  Deal?

    Russ Helfand
    Groovybits.com
  • Re: AJAX issue: you may need a manadatory UpdatePanel

    10-30-2006, 10:57 AM
    • Loading...
    • Osiris209
    • Joined on 02-11-2006, 4:19 PM
    • England
    • Posts 133
    • Points 568

    Seems like this has been fixed in Beta 3???

    Is that the case or am I just dreaming!?

    Steve

  • Re: AJAX issue: you may need a manadatory UpdatePanel

    10-30-2006, 11:15 AM
    • Loading...
    • Russ Helfand
    • Joined on 09-14-2005, 6:22 PM
    • Groovybits.com
    • Posts 741
    • Points 3,298

    Steve, I don't recall fixing this problem explicitly but I'm not surprised that it has gone away.  Both the adapters and ASP.NET AJAX continue to evolve so these sorts of things tend to get better over time.  There are still some problems using the adapters with ASP.NET AJAX but these will be fixed in the next rev of the kit and, meanwhile, can be fixed in your local version by following the directions provided here, http://forums.asp.net/thread/1442598.aspx.

    Regards,

    Russ Helfand
    Groovybits.com
  • Re: AJAX issue: you may need a manadatory UpdatePanel

    10-30-2006, 12:04 PM
    • Loading...
    • Osiris209
    • Joined on 02-11-2006, 4:19 PM
    • England
    • Posts 133
    • Points 568

    weird....i am still using the Atlas CTP at the mo.

    I think i better do some real testing before i release this!

  • Re: AJAX issue: you may need a manadatory UpdatePanel

    03-02-2009, 8:11 AM
    • Loading...
    • azizkap1269
    • Joined on 06-21-2008, 2:14 AM
    • Pune, India
    • Posts 9
    • Points 21

     Hi Russ,

    I am facing problem in using CSS Friendly control adapter and Update panel with APS tab control. I wrapped menu for the tab control in an update panel and all the View control in separate update panels. On the first tab it works fine but when i click on the other tabs  and hover the mouse on main menu, drop down menu start freezing means when mouse is moved away yet drop down menu remains there. Please advise what is the work around for this problem.

     

Page 1 of 1 (11 items)