温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:MyWebPages51aspx汉化最终版
当前文件:
MyWebPagesStarterKit/App_Code/Sections/ContactForm.cs,打开代码结构图
MyWebPagesStarterKit/App_Code/Sections/ContactForm.cs,打开代码结构图1//=============================================================================================== 2
// 3
// (c) Copyright Microsoft Corporation. 4
// This source is subject to the Microsoft Permissive License. 5
// See http://www.microsoft.com/resources/sharedsource/licensingbasics/sharedsourcelicenses.mspx. 6
// All other rights reserved. 7
// 8
//=============================================================================================== 9
10
using System; 11
using System.Web; 12
using System.Web.Services; 13
using System.Web.Services.Protocols; 14
using System.Collections.Generic; 15
16
namespace MyWebPagesStarterKit 17
{ 18
/// <summary> 19
/// Contact Form Section 20
/// This section displays a contact form 21
/// </summary> 22
public class ContactForm : Section<ContactForm.ContactFormData> 23
{ 24
public ContactForm() : base() { } 25
public ContactForm(string id) : base(id) { } 26
27
/// <summary> 28
/// E-Mail address, the contact-emails get sent to 29
/// </summary> 30
public string EmailTo 31
{ 32
get { return _data.EmailTo; } 33
set { _data.EmailTo = value; } 34
} 35
36
/// <summary> 37
/// E-Mail address, the contact-emails get sent to as a copy (optional) 38
/// </summary> 39
public string EmailCc 40
{ 41
get { return _data.EmailCc; } 42
set { _data.EmailCc = value; } 43
} 44
45
/// <summary> 46
/// Subject of the contact-mail 47
/// </summary> 48
public string Subject 49
{ 50
get { return _data.Subject; } 51
set { _data.Subject = value; } 52
} 53
54
/// <summary> 55
/// Text displayed above the contact-form 56
/// </summary> 57
public string Introtext 58
{ 59
get { return _data.Introtext; } 60
set { _data.Introtext = value; } 61
} 62
63
/// <summary> 64
/// Text displayed after the user has submitted the contact-form 65
/// </summary> 66
public string Thankyoutext 67
{ 68
get { return _data.Thankyoutext; } 69
set { _data.Thankyoutext = value; } 70
} 71
72
public override List<SearchResult> Search(string searchString, WebPage page) 73
{ 74
List<SearchResult> foundResults = new List<SearchResult>(); 75
string IntroTextDecoded = HttpUtility.HtmlDecode(SearchResult.RemoveHtml(Introtext)); 76
if (IntroTextDecoded.IndexOf(searchString, StringComparison.CurrentCultureIgnoreCase) > -1) 77
{ 78
foundResults.Add(new SearchResult( 79
string.Format("~/Default.aspx?pg={0}#{1}", page.PageId, SectionId), 80
"Contact-Form", 81
SearchResult.CreateExcerpt(IntroTextDecoded, searchString) 82
) 83
); 84
} 85
return foundResults; 86
} 87
88
public class ContactFormData 89
{ 90
public ContactFormData() 91
{ 92
EmailTo = string.Empty; 93
EmailCc = string.Empty; 94
Subject = string.Empty; 95
Introtext = string.Empty; 96
Thankyoutext = string.Empty; 97
} 98
99
public string EmailTo; 100
public string EmailCc; 101
public string Subject; 102
public string Introtext; 103
public string Thankyoutext; 104
} 105
} 106
} 107





}