Copied to clipboard

Flag this post as spam?

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


  • kunta1 7 posts 27 karma points
    Jun 19, 2012 @ 20:30
    kunta1
    0

    usercontrols don't work with postback

    hi - thanks for the suggestion but these cookiecuter solutions are worthless. If there is someone who knows how postbacks and usercontrols work, helpful information would be appreciated.

    this is a very simple matter that works perfectly fine in dev envoronmnet (asp.net only) but when moved to umbraco it has been nothing but problems and a waste of over two days time. The issue is with a very very simple usercontrol in an umbraco masterpage like such.

    masterpage content

    <%@ Master Language="C#" MasterPageFile="~/masterpages/masterpage.master" Inherits="secure_check" AutoEventWireup="true" %>

    <asp:content ContentPlaceHolderId="CP2" runat="server">

    <ajaxToolkit:ToolkitScriptManager ID="tsm1" runat="server" LoadScriptsBeforeUI="false" CombineScripts="true" EnablePartialRendering="true" ScriptMode="Release" />
     <section id="content">                   
         <umbraco:Macro Alias="myMacro1" runat="server">umbraco:Macro>
      section>
    asp:content>

     

    THE PROBLEM: simple -- no postback event occurs when clicking the checkbox; an autopostback should occur and the field should change to either "checked" or "unchecked" yet no postback. I am looking at the get/post request captures in firebug and each time the checkbox is selected no post occurs; simply the page refreshes the state. The page is in secure mode (SSL). Again this is pretty simple and basic and it works fine in asp.net dev testing environment. Oh, yes the page has a "form" with a "runat" equals server tag. Yes i have check the "browse properties" of the macro -- no problems. Does anyone have ideas?

  • kunta1 7 posts 27 karma points
    Jun 19, 2012 @ 21:44
    kunta1
    0

    since i cant seem to get any answers from the "gurus" i fixed the problem myself. The is definitely an Umbraco bug.

    in my usercontrol i have the following addtional control

     

    <asp:ImageButton ID="tbcfaqs" runat="server" CausesValidation="false" src="image path here" PostBackUrl="~/path1/pagename.aspx" />

     

    plus this control:

     

    <asp:CheckBox ID="chgpwd" runat="Server" AutoPostBack="true" OnCheckedChanged="chgpwd_CheckedChanged" Checked="False" />

    now when the check box is "clicked" what umbraco is doing is interpreting the postbackurl of the imagebutton as the postback for the page and posting the entire content back to the path listed in the postbackurl of the imagebutton. This is absolutely incorrect. Microsoft created the postbackurl back in 2.0 to accomodate the need to post back to specific url which may be different then the original page. It would be helpful if you would log this as a bug and fix it so someone else doesn't have to waste 1.5 days tracking down a simple issue.

  • Jesper Hauge 298 posts 487 karma points c-trib
    Jun 19, 2012 @ 23:30
    Jesper Hauge
    0

    Hello kunta1,

    Glad to hear that you solved your problem, all though I myself am still unsure what the actual solution was.

    About the bug; I wonder if you're aware, that due to the way Umbraco is funtioning, every request to your website goes through the /default.aspx file in the root of the site. Inside the umbraco assemblies there is a "routing engine" that finds the page the browser asks for based on the url the browser sends to the application.

    This means that you cannot have an ordinary .aspx file placed somewhere in your website available for requests, unless you explicitly tell Umbraco to leave this aspx file alone. This is done by adding the path to the aspx file to the "umbracoReservedUrls" appsettings value in your sites web.config file.

    I haven't tried it out for myself (I never user PostBackUrl, when developing Umbraco sites), but I suspect this could be the problem in play here. 

    Regards
    Jesper Hauge 

  • kunta1 7 posts 27 karma points
    Jun 20, 2012 @ 00:02
    kunta1
    0

    Quote:

    "About the bug; I wonder if you're aware, that due to the way Umbraco is funtioning, every request to your website goes through the /default.aspx file in the root of the site. Inside the umbraco assemblies there is a "routing engine" that finds the page the browser asks for based on the url the browser sends to the application.

    This means that you cannot have an ordinary .aspx file placed somewhere in your website available for requests, unless you explicitly tell Umbraco to leave this aspx file alone. This is done by adding the path to the aspx file to the "umbracoReservedUrls" appsettings value in your sites web.config file"

    Reply:

    Thanks for youre reply but i don't see the relevance. First, yes i am aware of the "umbracoReservedUrls" config setting but my situation has nothing to do with a reservedurl. The postbackurl listed on the "imagebuttton" is a valid url and should be rendered if the user clicks the button; however, as i mentioned in the post, that has nothing to do with the fact that the page was posing the content to the incorrect url. Maybe you could try if for yourself.

    As for your "not polite comment" i didn't realize you were the polite police. The purpose of posting the issue in multiple places was A) i wasn't sure where it needed to posted, no forums instructions B) I have no way of knowing which forum topics people are actively viewing (and responding to) so i figured i had a better chance with somene seeing the issue and therefore increasing the likelyhood of a reply. Sorry you had to read it twice. As a suggestion, maybe there could focus more on fixing the bugs and helping with issues. It may not have been your time wasted but it still counts.

Please Sign in or register to post replies

Write your reply to:

Draft