View-ForumsGroupView.ascx 读解

简介: 为了修改首页的框架,一路跟踪到了View-ForumsGroupView.ascx这个文件,其实他就是一个页面的模版,微软在这里并没有弄了太多花絮,所以阅读起来很方便。 导入了一些名称空间,并且声明了一个控件。
为了修改首页的框架,一路跟踪到了View-ForumsGroupView.ascx这个文件,其实他就是一个页面的模版,微软在这里并没有弄了太多花絮,所以阅读起来很方便。
img_a6339ee3e57d1d52bc7d02b338e15a60.gif <% @ Control Language = " C# "   %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
<% @ Register TagPrefix = " Forums "  Namespace = " AspNetForums.Controls "  Assembly = " AspNetForums.Controls "   %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
<% @ Import Namespace = " AspNetForums "   %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
<% @ Import Namespace = " AspNetForums.Controls "   %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
<% @ Import Namespace = " AspNetForums.Components "   %>
导入了一些名称空间,并且声明了一个控件。
img_a6339ee3e57d1d52bc7d02b338e15a60.gif < Forums:Ads Zone = " Inline "  runat = " server "   />
注释上显示是广告,我个人理解为登入框上面的banner。 img_1733afc10c7f06d60f7914a525e2b331.gif

img_405b18b4b6584ae338e0f6ecaf736533.gif img_1c53668bcee393edac0d7b3b3daff1ae.gif <%      if  ( Users.GetUser().IsAnonymous )  img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif %>
img_33d02437d135341f0800e3d415312ae8.gif
<table width="100%" cellspacing="0" cellpadding="5" border="0">
img_33d02437d135341f0800e3d415312ae8.gif    
<tr>
img_33d02437d135341f0800e3d415312ae8.gif        
<td>
img_33d02437d135341f0800e3d415312ae8.gif            
<!-- ForumGroupView.Header.End -->
img_33d02437d135341f0800e3d415312ae8.gif            
<Forums:Login SkinFilename="Skin-LoginSmall.ascx" runat="server" ID="Login1" />
img_33d02437d135341f0800e3d415312ae8.gif            
<!-- ForumGroupView.MainCentent.Start -->
img_33d02437d135341f0800e3d415312ae8.gif        
</td>
img_33d02437d135341f0800e3d415312ae8.gif    
</tr>
img_33d02437d135341f0800e3d415312ae8.gif
</table>
img_05dd8d549cff04457a6366b0a7c9352a.gif
<%    }
     %>
匿名用户显示的表格,感觉和动网的有些类似。
img_a6339ee3e57d1d52bc7d02b338e15a60.gif < table width = " 100% "  cellpadding = " 5 "  cellspacing = " 0 " >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
< tr >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
< td valign = " bottom "  colspan = " 2 " >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
< table width = " 100% "  cellpadding = " 0 "  cellspacing = " 0 " >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                
< tr >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    
< td  class = " txt4 "  align = " left "  nowrap >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                        
< Forums:DisplayUserWelcome runat = " server "   />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    
</ td >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    
< td  class = " txt4 "  align = " right "  valign = " bottom "  nowrap >
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif                        
<%      if  (  ! Users.GetUser().IsAnonymous )  img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif %>
img_33d02437d135341f0800e3d415312ae8.gif                        
<class="lnk3" href="<%=Globals.GetSiteUrls().MyFavorites%>">
img_33d02437d135341f0800e3d415312ae8.gif                            
<%=ResourceManager.GetString("MyFavorites_Description")%>
img_33d02437d135341f0800e3d415312ae8.gif                        
</a>
img_33d02437d135341f0800e3d415312ae8.gif                        
<br />
img_33d02437d135341f0800e3d415312ae8.gif                        
<!--<Forums:MarkAllRead runat="server" ID="Markallread1"/>-->
img_05dd8d549cff04457a6366b0a7c9352a.gif                        
<% }
  %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                        
< Forums:ForumAnchor  class = " lnk3 "  AnchorType = " PostsActive "  runat = " server "   />< br  />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                        
< Forums:ForumAnchor  class = " lnk3 "  AnchorType = " PostsUnanswered "  runat = " server "   />< br  />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    
</ td >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                
</ tr >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                
< tr >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    
< td align = " left " >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                        
< Forums:BreadCrumb ShowHome = " true "  runat = " server "  ID = " Breadcrumb1 "   />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    
</ td >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    
< td align = " right "   class = " txt4 " >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                        
< Forums:SearchRedirect ID = " SearchRedirect "  runat = " server "   />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    
</ td >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                
</ tr >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif            
</ table >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif        
</ td >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif    
</ tr >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
</ table >

这个就是登入以后所显示的表格。
下面就是论坛组的显示了,我们公司就是要我修改这里,所以准备一点一点分析。
img_a6339ee3e57d1d52bc7d02b338e15a60.gif < asp:Repeater EnableViewState = " false "  runat = " server "  id = " forumGroupRepeater " >
定义了一个Repeater控件,用来显示整个论坛组框架。
img_a6339ee3e57d1d52bc7d02b338e15a60.gif < HeaderTemplate >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    
<!--   *********  Repeater.Header.Start  *************   // -->
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
                     < table width = " 100% "   class = " tableBorder "  cellpadding = " 4 "  cellspacing = " 1 " >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                        
< tr >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                            
< td colspan = " 2 "   class = " column "  align = " center "  width = " * " ><%   =  ResourceManager.GetString( " ForumGroupView_Inline1 " %></ td >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                            
< td  class = " column "  align = " center "  width = " 177 "  nowrap ><%=  ResourceManager.GetString( " ForumGroupView_Inline4 " %></ td >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                            
< td  class = " column "  align = " center "  width = " 65 "  nowrap ><%=  ResourceManager.GetString( " ForumGroupView_Inline2 " %></ td >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                            
< td  class = " column "  align = " center "  width = " 65 "  nowrap ><%=  ResourceManager.GetString( " ForumGroupView_Inline3 " %></ td >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                        
</ tr >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    
</ table >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                    
<!--   *********  Repeater.HeaderTemplate.End  *************   // -->
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
                 </ HeaderTemplate >
定义了头模板,ResourceManager.GetString(),让我看了很长时间,个人以为是整理了一下字符串,然后又从配置里面把数据读出,从Language目录里的Resources.xml读出数据。
< td  class = " fh1 "  colspan = " 5 "  valign = " bottom " >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif   
< asp:ImageButton ID = " ExpandCollapse "  CommandArgument = ' <%# DataBinder.Eval(Container.DataItem, "ForumGroupID") %> '  ImageUrl = ' <%# Formatter.ExplandCollapseIcon( (ForumGroup) Container.DataItem ) %> '  ToolTip = ' <%# ResourceManager.GetString("ForumGroupView_ExpandCollapse")%> '  Runat = " server " />   & nbsp; < a href = " <%# Globals.GetSiteUrls().ForumGroup ( (int) DataBinder.Eval(Container.DataItem,  " ForumGroupID " )) %> " ><% # DataBinder.Eval(Container.DataItem, "Name"%></a>
  </ td >
这个表格显示了一个图片和论坛组的名字。
img_a6339ee3e57d1d52bc7d02b338e15a60.gif < Forums:ForumRepeater ForumGroupID = ' <%# DataBinder.Eval(Container.DataItem, "ForumGroupID") %> '  HideForums = ' <%# DataBinder.Eval(Container.DataItem, "HideForums") %> '  runat = " server " >
这是一个自定义的Repeater控件,具体代码还没研究过。
img_a6339ee3e57d1d52bc7d02b338e15a60.gif < td  class ="f1"  width ="20" >
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif
<% img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif # Formatter.StatusIcon( (Forum)Container.DataItem )  %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
</ td >
这个是显示版面是否有信息的那个图片。
img_a6339ee3e57d1d52bc7d02b338e15a60.gif < Forums:ForumLogo  runat ="server"  Forum ='<%#  (Forum) Container.DataItem % > ' />
这个是版面的logo,如果有就显示,没有就不显示,都在ForumsRepeater控件里都有了。
img_a6339ee3e57d1d52bc7d02b338e15a60.gif < b >< href ="<%# Globals.GetSiteUrls().Forum( ((Forum) Container.DataItem).ForumID ) %>" >
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif                                                    
<% img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif # DataBinder.Eval(Container.DataItem, "Name" %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                                                
</ a ></ b >
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif                                            
<% img_a76e9bb6ed00cf1c9c9f4ee2f04b558b.gif # Formatter.FormatUsersViewingForum( (Forum) Container.DataItem )  %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif                                            
< br  />


这个很容易理解,就是版面名字的显示,<%# Formatter.FormatUsersViewingForum( (Forum) Container.DataItem ) %>
是显示版面现在的在线人数,很多余的东西,缓存太久了,根本不能及时显示。

 

img_405b18b4b6584ae338e0f6ecaf736533.gif img_1c53668bcee393edac0d7b3b3daff1ae.gif < span  class ="txt5" ></ span > <% # DataBinder.Eval(Container.DataItem, "Description" %><% # Formatter.FormatSubForum( (Forum) Container.DataItem )  %> </ span >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
< br  />
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
< forums:ForumModerators  runat ="server"  ForumID ='<%#  ((Forum)Container.DataItem).ForumID % > '/>

版面的简介和版主显示
img_a6339ee3e57d1d52bc7d02b338e15a60.gif < td  class ="fh3"  align ="center"  width ="175" >
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif    
<% # Formatter.FormatLastPost( (Forum) Container.DataItem, (bool) true )  %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
</ td >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
< td  class ="fh3"  align ="center"  width ="64" >
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif    
<% # Formatter.FormatNumber( ((Forum) Container.DataItem).TotalThreads )  %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
</ td >
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
< td  class ="fh3"  align ="center"  width ="65" >
img_405b18b4b6584ae338e0f6ecaf736533.gifimg_1c53668bcee393edac0d7b3b3daff1ae.gif    
<% # Formatter.FormatNumber( ((Forum) Container.DataItem).TotalPosts )  %>
img_a6339ee3e57d1d52bc7d02b338e15a60.gif
</ td >
这三个分别显示:最后帖子,主题数,帖子数的。
好了,后面都是一些闭合语句了。

分析完毕,现在修改起来也简单了,以后研究的时候会继续贴上来的,嘿嘿 版面的简介和版主显示 这三个分别显示:最后帖子,主题数,帖子数的。好了,后面都是一些闭合语句了。分析完毕,现在修改起来也简单了,以后研究的时候会继续贴上来的,嘿嘿
相关文章
|
缓存
ViewPager2 详细使用
ViewPager2 详细使用
view.setTag()的正确使用姿势
开发中,我们经常要进行数据的传递,会使用到view.setTag()和view.getTag()方法,主要用在view的点击事件中,可以让数据跟着view走,这种方法很方便。一般情况下给view设置一个tag就够用了,某些情况下我们需要给一个view设置多个tag,在需要的时候再分别取出来,这就需要用到view.setTag()的一个重载方法view.setTag(int key,final Object Tag)了。
|
Java
viewpage 添加fragment 报错 viewpage demo LayoutInflater 自定义控件轮播图demo
viewpage 添加fragment 报错 viewpage demo LayoutInflater 自定义控件轮播图demo
81 0
viewpage 添加fragment 报错 viewpage demo LayoutInflater 自定义控件轮播图demo
|
前端开发 Java Android开发
03.Android之View原理问题
目录介绍 3.0.0.1 View的绘制需要经过哪些过程?有哪些常用回调方法?View的绘制流程的详细流程是怎样的? 3.0.0.2 View绘制流程,当一个TextView的实例调用setText()方法后执行了什么?请说一下原理…… 3.
1559 0
|
前端开发 Java Spring
|
前端开发 Java Spring
|
算法 MySQL 关系型数据库
|
.NET 开发框架 存储