Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Cesar Labarca 7 posts 27 karma points
    May 14, 2012 @ 20:05
    Cesar Labarca
    0

    .Net User Control; IsPostBack always False

    Hello Gurus,

    I have a 4.7.0 basic Runway site installed, and all I have chaged from the default is the inclusion of a couple of .Net user controls. The controls are fairly simple data grids, one with a paging control and another with a drop-down for selecting dates.

    The problem I have is that IsPostBack always evaluates to False when the drop-down value changes (it is set to autopostback) or when the paging control is clicked.

    The controls behave as if they do not function, even though they load the first time. When I select a date in the drop-down, a postback is done, the page refreshes, but nothing changes. This is because all my controls are binding to a default state, since the initial bind call is wrapped in an "If Not IsPostBack Then" wrapper, and since IsPostBack is always false, well, no happiness.

    It does not actually seem to be a bug, since I can find no references to the issue anywhere, so I am assuming that it is a configuration/code issue with my site/code.

    Can anyone please point me in the right direction? I am feeling my sanity slip between my fingers everytime I click on the drop-down and nothing happens.

    As an interesting note, if I wrap my user control ascx code in a <form runat="server"> tag, the user control functions properly, but, of course, nothing else does, since this does create a nested <form> tag condition. It does tell me that there might be something wrong with the viewstate of the control though.

    Thanks in advance,

    Cesar

  • Thomas Höhler 1237 posts 1709 karma points MVP
    May 14, 2012 @ 20:47
    Thomas Höhler
    0

    We have a nearly same problem, the auto postbacks and postbacks aren't fired correctly on Win7 with IE 9. Changing IE9 into compatibility mode resolves the problem. So we have set our intranet to force the compatibility mode.

    hth, Thomas

  • Cesar Labarca 7 posts 27 karma points
    May 14, 2012 @ 21:50
    Cesar Labarca
    0

    Hi Thomas,

    Thanks for the reply. Unfortunately, compatibility mode does not help. 

    I cannot find any information on this anywhere. I sold using Umbraco to my boss, who sold its use to our clients, prepared demos and whatnot, and now I cannot get the user controls to work.  Is it SharePoint time for me?  Noooooo...   Please help.

    Can anyone give me a short (or even long) list of things that need to be in place for the .net viewstate and IsPostBack to function properly? 

    Thanks,

    Cesar

  • Cesar Labarca 7 posts 27 karma points
    May 16, 2012 @ 00:00
    Cesar Labarca
    0

    Hello Gurus,

    I have solved the problem.

    If you have a LinkButton control anywhere in the masterpage (or any content contained in the masterpage) OR you have any control that has the PostBackURL property set, the asp.net viewstate breaks. Then, IsPostBack will not work.

    I went through all of my masterpage templates and all of my custom code, removed 3 PostBackURL assignments, and voila! It all works.

    Thanks,

    Cesar

  • Daniel Tuck 1 post 21 karma points
    Oct 09, 2013 @ 15:35
    Daniel Tuck
    0

    Thank you SO MUCH. I know this was over a year ago, but it's just helped me solve something that's been causing me problems for the past couple of days. That's the last thing I would have thought to look for, but stripping out any PostBackURL values in the user control does indeed make it work - I had an ASP.NET Repeater, and the ItemCommand function was never being called. Removing PostBackURL values makes the call go through.

    Who'd have thought it?!

  • Yoni 49 posts 118 karma points
    Feb 26, 2015 @ 15:13
    Yoni
    0

    Its no nearly 3 years later and this helped me solve my problem. MY workaround is a javascript that changes the "action" tag on the form.

    How is that Umbraco has not fixed this problem?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 26, 2015 @ 16:18
    Jan Skovgaard
    0

    Hi Yoni

    Because that's how webforms work :) So it's not really an Umbraco issue but an issue related to webforms where the whole page is inside a server-side form, which makes it hard to work with multiple forms etc. etc.

    So blame Microsoft ;-)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft