CommunityServer::Chameleon rocks - Asp.Net without aspx.cs!

Code tells:

1, you controls every char of output:

<CSControl:UserData ContainerId="WrapperID" Tag="H2" CssClass="WrapperClass"
    Property
="DisplayName" LinkTo="Profile" unrecognized="true">
   <LeaderTemplate>
      I'm a moderator and my 
<u>name</u> is
   
</LeaderTemplate>
   
<TrailerTemplate>
      .  So there!
   
</TrailerTemplate>
</CSControl:UserData>

outputs:

<h2 class="WrapperClass" id="WrapperID" unrecognized="true">I'm a moderator and my <u>name</u> is
<href="http://getben.com/user/Profile.aspx?UserID=2108">Ben Tiedt</a>.  So there!</h2>

2, data on demand

<CSControl:UserList runat="server" ShowHeaderFooterOnNone="false">

   
<QueryOverrides QueryType="ActiveUsers" SortBy="RecentPosts" SortOrder="Descending" PageSize="10" />

   
<HeaderTemplate>
      
<ol>
   
</HeaderTemplate>
   
<ItemTemplate>
      
<CSControl:UserData Property="DisplayName" runat="server" Tag="LI" LinkTo="PostsSearch" />
   
</ItemTemplate>
   
<NoneTemplate>
      There are no active users!
   
</NoneTemplate>
   
<FooterTemplate>
      
</ol>
   
</FooterTemplate>
</CSControl:UserList>

3, implicit, contextual data binding

<CSForum:ForumPostList runat="server">
   
<QueryOverrides SortBy="SortOrder" PagerID="Pager" PageSize="40" />
   
<HeaderTemplate>
      
<ul>
   
</HeaderTemplate>
   
<ItemTemplate>
      
<li>
         
<CSForum:ForumPostData Property="Subject" runat="server" />
         by
         
<CSControl:UserData Property="DisplayName" LinkTo="Profile" runat="server" />
      
</li>
   
</ItemTemplate>
   
<FooterTemplate>
      
</ul>
   
</FooterTemplate>
</CSForum:ForumPostList>
<CSControl:Pager runat="server" id="Pager" />

quote:
  • A UserData control rendered within a SectionList control would display data related to the first owner user of each Section (if at least one owner exists for the section; similarly, a UserList control would list all owners of the Section)
  • A UserData control rendered within a PostList control would display data related to the author of each post
4, build forms your way:
<CSBlog:ContactForm runat="server" SubjectTextBoxId="Subject" NameTextBoxId="Name"
    EmailTextBoxId
="Email" MessageTextBoxId="Body" SubmitButtonId="Submit">

   
<SuccessActions>
      
<CSControl:SetVisibilityAction runat="server" ControlIdsToShow="SuccessMessage" />
   
</SuccessActions>

   
<FormTemplate>
      
<div>
        <
CSControl:FormLabel LabelForId="Name" runat="server" ResourceName="Weblog_ContactForm_Name" />
        </
div>
      
<div><asp:TextBox id="Name" runat="server" /></div>
      
<div>
    <
CSControl:FormLabel LabelForId="Email" runat="server" ResourceName="Weblog_ContactForm_Email" />
        </
div>
      
<div><asp:TextBox id="Email" runat="server" /></div>
      
<div>
<
CSControl:FormLabel LabelForId="Subject" runat="server" ResourceName="Weblog_ContactForm_Subject" />
        </
div>
      
<div><asp:TextBox id="Subject" runat="server" /></div>        
      
<div>
<
CSControl:FormLabel LabelForId="Body" runat="server" ResourceName="Weblog_ContactForm_Body" />
        </
div>
      
<div><asp:TextBox id="Body" runat="server" TextMode="MultiLine" /></div>
      
<div>
      
<asp:Button id="Submit" runat="server" Text="Send" />
      
<CSControl:ResourceControl runat="Server" id="SuccessMessage"
            ResourceName
="Weblog_ContactForm_Sent" Visible="false" />
      
</div>
   
</FormTemplate>
</CSBlog:ContactForm>

5, conditional view:
<CSBlog:WeblogPostData Text="{0} comment(s)" Property="Replies" LinkTo="PostComments" runat="server">
   
<DisplayConditions>
      
<CSBlog:WeblogPostPropertyValueComparison runat="server" ComparisonProperty="Replies"
            ComparisonValue
="0" Operator="GreaterThan" />
   
</DisplayConditions>
</CSBlog:WeblogPostData>
<CSBlog:WeblogPostData Text="no comments" LinkTo="PostComments" runat="server">
   
<DisplayConditions>
      
<CSBlog:WeblogPostPropertyValueComparison runat="server" ComparisonProperty="Replies"
            ComparisonValue
="0" Operator="LessThanOrEqualTo" />
   
</DisplayConditions>
</CSBlog:WeblogPostData>

6, act as you want:
<SuccessActions>
   
<CSControl:GoToReferralUrlAction runat="server" />
   
<CSControl:SetVisibilityAction runat="server" ControlIdsToShow="SuccessMessage" />
</SuccessActions>

posted on   deerchao  阅读(624)  评论(1编辑  收藏  举报

编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
< 2007年3月 >
25 26 27 28 1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
1 2 3 4 5 6 7

统计

点击右上角即可分享
微信分享提示