Urgent: I need to create a new page with a fill in form, How ?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
14 anni tempo fa
^^^^ That's pretty complicated for a non .NET developer....
14 anni tempo fa
I'm sorry. But, that's the easiest way I can think of. I take advantage of using the same way that nopCommerce sends emails
14 anni tempo fa
so you mean i can do all these things without making changes in the code behind ? i can do all these things by adding a new page(Topic) and doing all this stuff from the Fckeditor only ? There is an option in the Fckeditor as "Sourcecode", i can do all the things you mentioned from there only ? as the website is already on the server LIVE, i just dont wanna touch the code that's why i am asking you.
14 anni tempo fa
What hkhieu  described would need a new codebheind page.
14 anni tempo fa
Here you go!

MemberInfo.aspx

<%@ Page Language="C#" MasterPageFile="~/MasterPages/TwoColumn.master" AutoEventWireup="true"
CodeBehind="MemberInfo.aspx.cs" Inherits="NopSolutions.NopCommerce.Web.MemberInfo" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cph1" runat="server">
    <asp:Label ID="ResultLabel" ForeColor="Red" runat="server" ></asp:Label><br />
    Name: <asp:TextBox ID="NameTextBox" runat="server"></asp:TextBox><br />
    Company: <asp:TextBox ID="CompanyTextBox" runat="server"></asp:TextBox><br />
    Contact #: <asp:TextBox ID="ContactNumberTextBox" runat="server"></asp:TextBox><br />
    Mobile phone: <asp:TextBox ID="MobilePhoneTextBox" runat="server"></asp:TextBox><br />
    Address: <asp:TextBox ID="AddressTextBox" runat="server"></asp:TextBox><br />
    # of Attendants: <asp:TextBox ID="AttendantTextBox" runat="server"></asp:TextBox><br /><br />
    <asp:Button ID="SubmitButton" runat="server" Text="Submit"
        onclick="SubmitButton_Click" />
</asp:Content>

MemberInfo.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using NopSolutions.NopCommerce.BusinessLogic.Messages;

namespace NopSolutions.NopCommerce.Web
{
    public partial class MemberInfo : BaseNopPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }

        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            string mailContent = string.Format("Name: {0}, Company:{1}, Contact#:{2}, Mobilephone:{3}, Address:{4},  Attendants:{5}",  NameTextBox.Text, CompanyTextBox.Text, ContactNumberTextBox.Text,
                                            MobilePhoneTextBox.Text, AddressTextBox.Text, AttendantTextBox.Text);
            try
            {
                MailAddress from = new MailAddress(MessageManager.AdminEmailAddress, MessageManager.AdminEmailDisplayName);
                MailAddress to = new MailAddress("[email protected]");
                MessageManager.SendEmail("Member Info", mailContent, from, to);
                ResultLabel.Text = "email successfully sent";
            }
            catch (Exception ex)
            {
                ResultLabel.Text = "Error: " + ex.Message;
            }
        }
    }
}

Add it to nopCommerceStore root folder, create a link some where to it and you ready to go.
I am not a graphic designer, so you make it beautiful yourself. But most importantly, It runs.
14 anni tempo fa
You probably need some extra coding for data validation to avoid people entering non-sense value and maybe a captcha.

Forget about FCKeditor. It won't help you in this case.
14 anni tempo fa
my website is already live on the server, so if i add this page, i have to re-build the solution right as we are adding .cs file ? and i have to replace the new build .dll files right i mean i have to replace the old folders with the new one right ?
14 anni tempo fa
Absolutely right!.
14 anni tempo fa
yes you'll have to rebuild and replace .dll files
14 anni tempo fa
Thanks a lot for all your replies...i appreciate it
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.