Copied to clipboard

Flag this post as spam?

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


  • Michael Jensen 35 posts 85 karma points
    Mar 27, 2013 @ 20:59
    Michael Jensen
    0

    Contact side from a User control whit the use of Umbraco systems.

    Hey iam tryning to make a contact form that sends mail efrom my busnies site.

    iam not the bigest C# shark yet so i startede on google and i almost flel os my shair when i found this, http://www.blogfodder.co.uk/2011/12/30/simple-contact-form-template-for-umbraco i read the intire site and mace the files uploadet them and the i strok buttom blak  i get this error when i klik the Browse properties  can som help me make it work ore tell me what i ned do chance to make it work, the thing i love from this one is the posibelity that i can sen the E-mail and thank you pages in umbraco this give my the posibelity to use on many pages whit out the need to edit to fit a new page if it dosnet net to

    I realy hope som can help me. or tell me what i need to add to my own home made page page so i have the samen posibelitys. as Browse properties

     

    I use the lates wersion of umbraco on a surftown busnines server whit full trust activatede.

  • Charles Afford 1163 posts 1709 karma points
    Mar 30, 2013 @ 09:41
    Charles Afford
    0

    Hi, what are you trying to do and what sort of errors are you getting?  I cannot see the image you have posted or the errors you are getting.  Thanks.  Charlie :)

  • Michael Jensen 35 posts 85 karma points
    Mar 30, 2013 @ 14:48
    Michael Jensen
    0

    The images show fine at my browser. ut the error i get is this.

    i have copy paste from the site i link to, as i ondestan the side that i was just copy and use..

     

     

    Error reading ~/usercontrols/MjSolutionsContactForm.ascx

    The following list shows the Public Properties from the Control. By checking the Properties and click the "Save Properties" button at the bottom, umbraco will create the corresponding Macro Elements.

     

    System.Web.HttpCompileException (0x80004005): d:\hshome\solutions\mj-solutions.dk\usercontrols\MjSolutionsContactForm.ascx.cs(6): error ASPNET: Make sure that the class defined in this code file matches the 'inherits' attribute, and that it extends the correct base class (e.g. Page or UserControl). at System.Web.Compilation.AssemblyBuilder.Compile() at System.Web.Compilation.BuildProvidersCompiler.PerformBuild() at System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean throwIfNotFound, Boolean ensureIsUpToDate) at System.Web.Compilation.BuildManager.GetVPathBuildResult(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile, Boolean ensureIsUpToDate) at System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) at umbraco.developer.assemblyBrowser.Page_Load(Object sender, EventArgs e)

  • Michael Jensen 35 posts 85 karma points
    Apr 03, 2013 @ 08:34
    Michael Jensen
    0

    Nowe one that can help me ??

  • Charles Afford 1163 posts 1709 karma points
    Apr 03, 2013 @ 09:47
    Charles Afford
    0

    Hi can you post the template your are using?  The problem is you are not inherting properly.  I am gussing its going to be becuase you are not inherting from master. In your first template are you using this?

    MasterPageFile="~/umbraco/masterpages/default.master"

    Charlie :)

  • Charles Afford 1163 posts 1709 karma points
    Apr 03, 2013 @ 09:48
    Charles Afford
    0

    Please could you post 

    MjSolutionsContactForm.ascx Thanks.  Charlie

  • Michael Jensen 35 posts 85 karma points
    Apr 03, 2013 @ 10:14
    Michael Jensen
    0

    Hey..

    cant se hove it can be a master page problem do to problem is in backend not frontend.

    i have made a video of the problem you can se it Hear 

    This is the files..

    ASCX

     

     

     

       

           

           

     

           

           

     

           

           

            

           

           

     

           

           Skriv din besked her

           

            

           

           

       

     

     

    ASCX.CS 

     

    using System;

    using System.Text;

    using System.Web.UI;

    using umbraco;

     

    public partial class ContactForm : UserControl

    {

        // Macro Parameters

        public string EmailAddress { get; set; }

        public int ThankYouPage { get; set; }

     

        // Hold a couple of formatting strings for use later

        private const string ErrorFormat = "

    {0}

    ";

        private const string EmailLineFormat = "

    {0}: {1}

    ";

     

        protected void BtnSubmitClick(object sender, EventArgs e)

        {

            // Quick check for mandatory fields

            if (string.IsNullOrWhiteSpace(tbName.Text) | string.IsNullOrWhiteSpace(tbEmail.Text) | string.IsNullOrWhiteSpace(tbPhone.Text))

            {

                // Found an empty field, return error

                litError.Text = string.Format(ErrorFormat, "Please complete all mandatory fields");

                return;

            }

     

            // No errors create email

            var email = new StringBuilder();

            email.AppendFormat(EmailLineFormat, "Name", tbName.Text);

            email.AppendFormat(EmailLineFormat, "Email", tbEmail.Text);

            email.AppendFormat(EmailLineFormat, "Phone", tbPhone.Text);

            email.AppendFormat(EmailLineFormat, "Country", tbCountry.Text);

            email.AppendFormat(tbEnquiry.Text);

     

            // Send the email

            library.SendMail(EmailAddress, EmailAddress, "Contact Form Enquiry", email.ToString(), true);

     

            // Redirect to thank you page

            Response.Redirect(library.NiceUrl(ThankYouPage));

        }

    }

     

    Michael

  • Michael Jensen 35 posts 85 karma points
    Apr 08, 2013 @ 08:30
    Michael Jensen
    0

    Is thaer no that can help me ?

  • Sahan Rodrigo 25 posts 97 karma points
    Apr 08, 2013 @ 10:00
    Sahan Rodrigo
    0

    Hi Michael,

    I think there should be something wrong with your .ascx source files. Please check your source file and change below marked "ContanctForm" name to your correct project. Normally this should be you project "namespace. userControl class name". In this case your userControl class name is "ContanctForm". 

    Beast way to solve this issue, you can create new user control in your visual studio project, check the ascx file source, compare your ContactForm source and change the Inherits attribute to correct name.   

    Hope this helps,

    Sahan

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ContactForm.ascx.cs" Inherits="ContactForm" %>
  • Michael Jensen 35 posts 85 karma points
    Apr 08, 2013 @ 10:14
    Michael Jensen
    0

    Hey Sahan

    That i have tryd and i keep getting the same error.

     

    Michael

     

  • Sahan Rodrigo 25 posts 97 karma points
    Apr 08, 2013 @ 11:23
    Sahan Rodrigo
    0

    Hi Michael,

    What is the nameSpace you are working on your project? I can see that you don't have any namspace on your C# code file, because your partial class ContactForm not included in a naspace like below.  Is this correct? 

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    namespace WebApplication1
    {
        public partial class WebUserControl1 : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
     
            }
        }
    }

     

    Regards,

    Sahan

  • Michael Jensen 35 posts 85 karma points
    Apr 08, 2013 @ 11:29
    Michael Jensen
    0

    That is right i use as i wrote an copy past from the site.  dont nowe wath i have don but the error dos not show up eny more but i dont get it to show on the page if set it up to be use in ad editor.

     

    Michael

  • Michael Jensen 35 posts 85 karma points
    Apr 08, 2013 @ 11:49
    Michael Jensen
    0

    my C# look like this

    using System;
    using System.Text;
    using System.Web.UI;
    using umbraco;
    
        public partial class ContactForm : UserControl
        {
            // Macro Parameters
            public string EmailAddress { get; set; }
            public int ThankYouPage { get; set; }
    
            // Hold a couple of formatting strings for use later
            private const string ErrorFormat = "<p class=\"formerror\">{0}</p>";
            private const string EmailLineFormat = "<p><strong>{0}</strong>: {1}</p>";
    
            protected void BtnSubmitClick(object sender, EventArgs e)
            {
                // Quick check for mandatory fields
                if(string.IsNullOrWhiteSpace(tbName.Text) | string.IsNullOrWhiteSpace(tbEmail.Text) | string.IsNullOrWhiteSpace(tbPhone.Text))
                {
                    // Found an empty field, return error
                    litError.Text = string.Format(ErrorFormat, "Please complete all mandatory fields");
                    return;
                }
    
                // No errors create email
                var email = new StringBuilder();
                email.AppendFormat(EmailLineFormat, "Name", tbName.Text);
                email.AppendFormat(EmailLineFormat, "Email", tbEmail.Text);
                email.AppendFormat(EmailLineFormat, "Phone", tbPhone.Text);
                email.AppendFormat(EmailLineFormat, "Country", tbCountry.Text);
                email.AppendFormat(tbEnquiry.Text);
    
                // Send the email
                library.SendMail(EmailAddress, EmailAddress, "Contact Form Enquiry", email.ToString(), true);
    
                // Redirect to thank you page
                Response.Redirect(library.NiceUrl(ThankYouPage));
            }
        }

     

  • Sahan Rodrigo 25 posts 97 karma points
    Apr 08, 2013 @ 12:15
    Sahan Rodrigo
    0

    Hi Michael,

    Please watch this video and follow the correct steps when creating userControls and using it in Umbraco.

    http://umbraco.com/help-and-support/video-tutorials/introduction-to-umbraco/developer-introduction/using-net-user-controls.aspx

    Also, please mark as correct if it is the answer for your question.

    Hope this helps,

    Sahan

  • Michael Jensen 35 posts 85 karma points
    Apr 09, 2013 @ 07:50
    Michael Jensen
    0

    Hey Sahan.

    It dos help a lot i only have one thing i hope you can help whit 

    the form iam tryning to use take advantes of the using umbraco; but howe do i get visual 2012 to let mit Build whit out getting this error

    Error1The type or namespace name 'umbraco' could not be found (are you missing a using directive or an assembly reference?)Z:\Visual studio\Projects\Contakt form\Contakt form\ContactForm.ascx.cs47Contakt form

    Michael
  • Sahan Rodrigo 25 posts 97 karma points
    Apr 09, 2013 @ 09:55
    Sahan Rodrigo
    100

    Hi Michael,

    You will be able to find umbraco.dll bin folder of your umbraco website / build. You just need to add that umbraco.dll as a reference to your Visual Studio project. This will solve your issue. 

    Hope this helps,

    Sahan

     

  • Michael Jensen 35 posts 85 karma points
    Apr 09, 2013 @ 10:02
    Michael Jensen
    0

    Yep That dit the trick

    and knowe alle my problems is solv may problems. it works  just great.

     

    can i just ad more fealds online ore do i need to build a new DLL if i do

     

    /michael

  • Sahan Rodrigo 25 posts 97 karma points
    Apr 09, 2013 @ 10:22
    Sahan Rodrigo
    0

    Hi Michael,

    I don't understand your last question. Please can you explaine it further?

    "can i just ad more fealds online ore do i need to build a new DLL if i do"

    Regards,

    Sahan

  • Michael Jensen 35 posts 85 karma points
    Apr 09, 2013 @ 10:25
    Michael Jensen
    0

    Hi Sahan

    let say, i have a costumor i my clientel need like a text feald more the i have nowe can i just add it til the ascx file and the .cs file.. whitout builden a new DLL file.

     

    /Michael

     

  • Sahan Rodrigo 25 posts 97 karma points
    Apr 09, 2013 @ 10:46
    Sahan Rodrigo
    0

    Hi Michael,

    As you know that your userControl is a combination of .cs code file and the .ascx source file. But, for the Umbraco project, we don't copy .cs file. But we need to copy both .ascx file and .dll. So if you have done any changes to .cs file, you must copy .dll file  (.cs file changes will be compiled in to .dll). But if you have only changed the ascx file, you no need to copy .dll. 

    Hope this helps,

    Sahan 

Please Sign in or register to post replies

Write your reply to:

Draft