Copied to clipboard

Flag this post as spam?

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


  • Dennis Flæng Jørgensen 35 posts 145 karma points c-trib
    Apr 14, 2015 @ 11:49
    Dennis Flæng Jørgensen
    0

    Umbraco 7.2.4 Webform User Control - Button click does nothing

    I've been searching for at past few hours with not result to this problem.

    Im trying to add a webform user control as a macro to a page.

    But all it does when i click the button is refresh the page. It doesnt excute my C#-code.

     

    Page.aspx

    <asp:Content ContentPlaceHolderID="cp_content" runat="server">

    <form runat="server" ID="frmMain">

    <asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager>

    <umbraco:Macro Alias="GridLayoutPages" runat="server" />

    </form>

     

    </asp:Content>

     

    Callback.ascx

    <asp:Panel runat="server" DefaultButton="BtnSendMail" ID="pnlCallback">

        <div class="callback clearfix" id="callbackContainer" runat="server">

            <div style="background-image: url('<%=personImageUrl %>')" class="clearfix">

                <h1>Kom i kontakt med os</h1>

                <div class="col-md-6 call-box clearfix">

                    <asp:TextBox runat="server" ID="txbName" placeholder="Indtast navn" />

                    <asp:TextBox runat="server" ID="txbPhone" placeholder="Indtast Tlf" />

     

                    <asp:Button runat="server" ID="BtnSendMail" Text="Bliv ringet op" OnClick="SendMail_Click" />

    ...

                </div>

            </div>

        </div>

    </asp:Panel>

     

    Callback.ascx.cs

    ...

    namespace MySupportMergedUserControls

    {

     

        public partial class Callback : UserControl

        {

            ...

            public void SendMail_Click(object sender, EventArgs e)

            {

                Response.Redirect("http://www.google.com");

            }

        }

    }

     

    Any help/suggestion is appreciated

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Apr 14, 2015 @ 12:07
    Dennis Aaen
    0

    Hi Dennis and welcome to our :-),

    Since you are using the latest Umbraco version 7.2.4, have you changed it to run in WebForms if not then the defaultRenderingEngine is MVC, Umbraco comes with MVC as default from Umbraco 7. You can changes it by doing this: https://our.umbraco.org/documentation/reference/Templating/Mvc/

    And even you are running your installation in WebForms mode, you can still use Razor. Try to see this tweet from Sebastiaan https://twitter.com/protherj/status/587745557377978369 from the Umbraco HQ.

    Hope this helps,

    /Dennis

  • Dennis Flæng Jørgensen 35 posts 145 karma points c-trib
    Apr 14, 2015 @ 12:24
    Dennis Flæng Jørgensen
    0

    Yes i've changed the default rendering engine

     

    Config\umbracoSettings.cfg¨

      ...

      <templates>

        <!-- To switch the default rendering engine to MVC, change this value from WebForms to Mvc -->

        <defaultRenderingEngine>WebForms</defaultRenderingEngine>

      </templates>

      ...

     

    About the tweet i dont know what to make of it. The site im working on is 100% WebForms at least the parts im working on.

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Apr 14, 2015 @ 12:29
    Dennis Aaen
    0

    Hi Dennis,

    I am not a .NET developer, but just want to be sure that you have changed the defaultRenderingEngine from MVC. Perhaps some of the .NET guys in this community can help you with your specific problem.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft