⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contactform.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Web.UI.WebControls;
using CommunityServer.Blogs.Components;
using CommunityServer.Components;

namespace CommunityServer.Blogs.Controls
{
	/// <summary>
	/// Summary description for ContactForm.
	/// </summary>
	public class ContactForm : WeblogThemedControl
	{
		public ContactForm()
		{
			//
			// TODO: Add constructor logic here
			//
		}

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad (e);
            if(!CurrentWeblog.ShowContact)
            {
                Context.Response.StatusCode = 404;
                Context.Response.SuppressContent = true;
                Context.Response.End();
            }
        }

        /// <summary>
	    /// Override this method to attach templated or external skin controls to local references.
	    /// </summary>
	    /// <remarks>
	    /// This will only be called if the non-default skin is used.
	    /// </remarks>
	    protected override void AttachChildControls()
	    {
           Button btnSubmit = FindControl("btnSubmit") as Button;
           btnSubmit.Click +=new EventHandler(btnSubmit_Click);
            btnSubmit.Text = ResourceManager.GetString("Weblog_ContactForm_Button");

        }

        private void btnSubmit_Click(object sender, EventArgs e)
        {
            Label Msg = FindControl("Msg") as Label;
            Msg.Text = string.Empty;
            if(!Page.IsValid)
                return;

            TextBox tbName = FindControl("tbName") as TextBox;
            TextBox tbSubject = FindControl("tbSubject") as TextBox;
            TextBox tbEmail = FindControl("tbEmail") as TextBox;
            TextBox tbBody = FindControl("tbBody") as TextBox;

            string link = Globals.HostPath(Context.Request.Url) + BlogUrls.Instance().HomePage(CurrentWeblog.ApplicationKey);
            Emails.QueueContactRequest(CurrentWeblog.Email,tbEmail.Text,tbSubject.Text,tbBody.Text,CurrentWeblog.Name,link);

            
            Msg.Text = ResourceManager.GetString("Weblog_ContactForm_Sent");

           

        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -