Possible bug with Partial Rendering ?

Last post 09-21-2006 9:27 AM by u2envy1. 9 replies.

Sort Posts:

  • Possible bug with Partial Rendering ?

    06-01-2006, 10:39 AM
    • Member
      55 point Member
    • jods
    • Member since 06-01-2006, 2:35 PM
    • Posts 11
    I have a page which is working perfectly well. The page has a ScriptManager on it.

    When I change the EnablePartialRendering to true, suddenly some of my LinkButtons don't work anymore. The event is fired (I've put a breakpoint), and everything seems to be working well on the server (no exception, apparently).

    BUT, using fiddler, I've discovered that the response sent to the client is:

    HTTP/1.1 200 OK
    Server: Microsoft-IIS/5.1
    Date: Thu, 01 Jun 2006 14:29:58 GMT
    X-Powered-By: ASP.NET
    X-AspNet-Version: 2.0.50727
    Pragma: no-cache
    Cache-Control: no-cache, no-store
    Pragma: no-cache
    Expires: -1
    Content-Type: text/xml; charset=utf-8
    Content-Length: 100

    <delta><pageError message="Object reference not set to an instance of an object." /></delta></delta>

    Can someone help me on this one ? I really would like to enable partial rendering, so that I can use UpdatePanel and make my page more slick (it has a lot of controls).
  • Re: Possible bug with Partial Rendering ?

    06-01-2006, 1:03 PM
    • Contributor
      7,416 point Contributor
    • Garbin
    • Member since 09-17-2004, 12:35 PM
    • Sassari, Italy
    • Posts 1,506
    • ASPInsiders
      TrustedFriends-MVPs
    Hi,

    the error message is relative to an exception being generated on the server. My suggestion is to debug your application and find where the exception is being raised.

    Otherwise, you could post here the relevant code.
    Alessandro Gallo | Blog | My book: ASP.NET AJAX In Action
  • Re: Possible bug with Partial Rendering ?

    06-01-2006, 7:51 PM
    • Member
      10 point Member
    • PinkFloyd
    • Member since 06-01-2006, 11:43 PM
    • Posts 2

    I have some problems with Partial Rendering too... For example: I have a list box and when i select an item, the list needs to hide but it doesn´t work.

    The most curious thing is.. If I put a button with any PostBackURL the page works...

    Do u have any Idea what is happening?

     

    Oh... Sorry for my poor English and my mistakes!!!

     

    Tks!!!!

  • Re: Possible bug with Partial Rendering ?

    06-02-2006, 1:13 AM
    • Member
      55 point Member
    • jods
    • Member since 06-01-2006, 2:35 PM
    • Posts 11

    As I wrote in my original post, I've tried to debug the code, but it runs fine on the server. I can step through it without problems (and everything seems to be right), and even with break on exceptions enabled, there seems to be no exception.

    Moreover, with EnablePartialRendering = false, the very same code runs perfectly fine. So the only guess I can make is that if there's some exception raised, it is raised by the ScriptManager (which would qualify as a bug in atlas, I guess).

    What my code does, is that it modifies the Viewstate and unhides a few controls. It's strange, but when I use an ImageButton to raise the event rather than the LinkButton, it works (even with partial rendering enabled).

  • Re: Possible bug with Partial Rendering ?

    06-02-2006, 10:38 AM
    • Member
      10 point Member
    • astrauss
    • Member since 06-02-2006, 2:32 PM
    • Posts 2

    I encounter the same problem with PartialRendering in an UpdatePanel. I'm dynamically assign image URLs to image elements in a ASP.Net for-loop. It works for the initial load of the page however when the URL need to change due to a OnSelectedIndexChanged event the URL are messed up and the pictures are not displayed.

    When I set EnablePartialRendering to "false" it works as expected

  • Re: Possible bug with Partial Rendering ?

    06-06-2006, 2:01 AM
    • Member
      55 point Member
    • jods
    • Member since 06-01-2006, 2:35 PM
    • Posts 11

    Just to help others with potentially the same issue: I finally found out what was wrong.

    I was dynamically generating the LinkButtons, and I didn't explicitely set an ID. It looks like Atlas had a hard time tracking them and generated a silent exception.

    Always setting an ID, even for the dynamically generated controls, seems to solve my problem.

  • Re: Possible bug with Partial Rendering ?

    06-07-2006, 3:08 AM
    • Member
      10 point Member
    • astrauss
    • Member since 06-02-2006, 2:32 PM
    • Posts 2

    Thanks for the update. I just checked if this also helps in my case as I also did not set ids for the dynamically generated items. However this didn't do the trick...

     

    Apart from that I think its always a good idea to set ids regardless if they are referenced by your own code or not.

  • Re: Possible bug with Partial Rendering ?

    06-15-2006, 7:51 AM
    • Member
      42 point Member
    • wouter_
    • Member since 05-11-2006, 6:19 AM
    • Posts 9

    Hi, I got the same thing, though in my case I have a GridView that won't get into Edit mode, also because I have a ScriptManager control on the page. When I remove that ScriptManager, or set it's EnablePartialRendering property to false it works fine. But then I lose the atlas functionality I want to use.

    I can also add an ID to the GridView to solve this problem, but that causes other problems for me... (I also disagree that it's always a good idea to set ID's on all controls, since it clutters up both the source code as well as the output. It can also significantly increase the size of the renederd page, especially if you have a lot of nested controls. If you do not specify an ID it will not be rendered.)

    See some sample code below. When clicking an Edit link in the GridView a request is made to the webserver and all expected methods are called. But the response being sent back to the browser is:
    <delta><pageError message="Object reference not set to an instance of an object." /></delta></delta>
    (that's is not even valid xml...)

    <%

    @ Page Language="C#" AutoEventWireup="true" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <
    script runat="server">
    protected void Page_Load(object sender, EventArgs e) {
        if (!this.IsPostBack) {
            this.DataBind();
        }
    }
    protected string[] GetDataSource() {
        return new string[] { "Aaa", "Bbbbbbbb", "Cccc" };
    }
    protected void GridView_RowEditing(object sender, GridViewEditEventArgs e) {
        ((
    GridView)sender).EditIndex = e.NewEditIndex;
        this.DataBind();
    }
    protected void GridView_RowUpdating(object sender, GridViewUpdateEventArgs e) {
        //TODO: Save Data
        ((GridView)sender).EditIndex = -1;
        this.DataBind();
    }
    protected void GridView_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) {
        ((
    GridView)sender).EditIndex = -1;
        this.DataBind();
    }
    </script>
    <
    html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>Test2</title>
    </head>
    <body>
    <form action="" runat="server">
        <atlas:ScriptManager runat="server" EnablePartialRendering="true" />
        <asp:GridView runat="server" AutoGenerateEditButton="true" DataSource="<%# this.GetDataSource() %>" OnRowEditing="GridView_RowEditing" OnRowCancelingEdit="GridView_RowCancelingEdit" OnRowUpdating="GridView_RowUpdating" />
    </form>
    </body>
    </
    html>
  • Re: Possible bug with Partial Rendering ?

    06-15-2006, 4:11 PM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs

    hello guys.

    well, to me this is not a problem of atlas...it's a problem on the way asp.net renders its controls. to me, they should allways have an id applied to them. as you have noticed, the control doesn't generate an id when you perform its initial rendering. to me, this is a bug!  in fact, if you check the source of the page during the editing phase, you'll see that it's there!

    regarding the problem you've mentioned, it's realted with the way the atlas client platform works. you see, atlas hsa to ensure that it handles all the postbacks (partial and complete). normally, when you add the id to the control, it'll generate a request and it'll identify the scriptmanager control as the responsible for the request. as a consequence, you'll have a partial postback instead of a full postback. you can check this by seeing the __doPostBack method of the pagerequestmanager client class.here's an excerpt of the place where the problem occurs:

    _postbackSettings = null;
            var postbackElement = findNearestElement(eventTarget);
            if (postbackElement) {
                _postbackSettings = getPostbackSettings(postbackElement);
            }
            else {
                _postbackSettings = createPostbackSettings(true, _scriptManagerID);
            }
            if (!_postbackSettings.async) {
                _originalDoPostBack(eventTarget, eventArgument);
                return;
            }

    if you look at the edit buttons, they'll allways indicate the id of the grid; unfortunatelly, the asp.net engine isn't rendering the id on the 1st request and due to this, findNearestElement returns null. so, you'll have the wrong postback settings and this will result in the object expected error you've mentioned (btw, this happens because the scriptmanager class sees there's a delta header on the request -added by the pagerequestmanager class, since it has started a partial postback, instead of a full postback - and hooks up the rendering of the page; during that phase, it tries to go through all the updatepanels by using the _updatePanels field; unfortunatelly, in this example the field is null and you get the exception).

    btw, i think this thread deserves a new one with the word BUG on its title pointing to here so that this behavior gets fixed.

     

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: Possible bug with Partial Rendering ?

    09-21-2006, 9:27 AM
    • Member
      163 point Member
    • u2envy1
    • Member since 06-29-2006, 3:38 AM
    • Posts 154

    Sorry to bring this topic back. Im getting the same error. Just wanted to know, how do I set a ID on a HyperlinkField in a GridView? Hope this ID thing can sort it out for me also.

    Thanks and sorry again.

Page 1 of 1 (10 items)