打印本文 打印本文 关闭窗口 关闭窗口
使用 ASP.NET Community Starter Kit建造网站
作者:武汉SEO闵涛  文章来源:敏韬网  点击数6105  更新时间:2009/4/23 10:44:10  文章录入:mintao  责任编辑:mintao
   Title questionPreview;
   BriefDescription introductionPreview;
   FaqAnswer answerPreview;
   FaqReference referencePreview;
   string _skinFileName = "Faqs_AddFaq.ascx";
   string _sectionContent =
      "ASPNET.StarterKit.Communities.Faqs.FaqSection";
}

AddFaq页面与EditFaq的页面基本类似,只是要增加用不同页面显示内容的选项。

FAQ Page Content Skins

我们的FAQ模块需要有3个界面:

l        显示单个FAQ详细内容的界面

l        显示多个FAQ列表的界面

l        新增或修改一个FAQ的界面

我们至少要在默认主题目录中创建这3个界面文件。如果希望有不同界面还可以继续增加其它的主题界面。对于新增或修改FAQ的页面可能如下:

这里要确定界面文件名与内容页面类中SkinFileName属性的赋值吻合。还要注意控件名称,必须与调用类中GetControl方法所用参数名相同。

最简便的方法是从一个已有的界面窗口开始创建界面,因为你还要保持与基类的控件相同。应该还记得我们的AddFaq类是从ContentAddPage继承而来,他需要界面上有一些特定的控件,如名为pnlFormde面板和名为btnAdd的按钮。我们先看以下Faq_AddFaq的界面:

<%@ Control %>
<%@ Register TagPrefix="community"
             Namespace="ASPNET.StarterKit.Communities"
             Assembly="ASPNET.StarterKit.Communities" %>
<community:SectionTitle
   CssClass="Form_Title"
   Runat="Server"
   ID="Sectiontitle1"
   NAME="Sectiontitle1"/>
<p class="Form_Description">
   Use this form to add or edit an FAQ.
</p>
<asp:Panel id="pnlForm" Runat="Server">
<TABLE cellSpacing="0" cellPadding="3" width="520"
       class="Form_Table">
   <TR>
      <TD class="Form_SectionRow">
         FAQ Form
      </TD>
   </TR>
   <tr class="Form_LabelRow">
      <td >
         <span class="Form_LabelText">Question:</span>
         <asp:RequiredFieldValidator
            ControlToValidate="txtQuestion"
            Text="(Required)"
            Runat="Server"
            ID="Requiredfieldvalidator1"
            NAME="Requiredfieldvalidator1"/><br>
         <asp:TextBox id="txtQuestion"
            CssClass="Form_Field"
            columns="40"
            runat="server">
         </asp:TextBox>
      </td>
   </tr>
...

用于显示内容的界面相对容易构建,你只需按照合适的位置排列控件即可。下面是显示单独FAQ的界面:

<%@ Control %>
<%@ Register
    TagPrefix="community"
    Namespace="ASPNET.StarterKit.Communities"
    Assembly="ASPNET.StarterKit.Communities" %>
<table width="100%" cellspacing="0" cellpadding="11"
       class="Faq_Table">
   <tr>
      <td class="Faq_IntroCell">>
         <div align="right">
            <community:DisplayTopic Runat="Server"
                                    ID="Displaytopic1"
                                    NAME="Displaytopic1" />
         </div>
         <community:Title Runat="Server" ID="Title1"
                                         NAME="Title1" />
         <br>
         <br>
         Posted by
         <community:Author CssClass="Faq_AuthorLink"
       &

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ...  下一页 >> 

打印本文 打印本文 关闭窗口 关闭窗口