• <i id='9vQcW'><tr id='9vQcW'><dt id='9vQcW'><q id='9vQcW'><span id='9vQcW'><b id='9vQcW'><form id='9vQcW'><ins id='9vQcW'></ins><ul id='9vQcW'></ul><sub id='9vQcW'></sub></form><legend id='9vQcW'></legend><bdo id='9vQcW'><pre id='9vQcW'><center id='9vQcW'></center></pre></bdo></b><th id='9vQcW'></th></span></q></dt></tr></i><div id='9vQcW'><tfoot id='9vQcW'></tfoot><dl id='9vQcW'><fieldset id='9vQcW'></fieldset></dl></div>
    <legend id='9vQcW'><style id='9vQcW'><dir id='9vQcW'><q id='9vQcW'></q></dir></style></legend>

    1. <small id='9vQcW'></small><noframes id='9vQcW'>

        <bdo id='9vQcW'></bdo><ul id='9vQcW'></ul>

        <tfoot id='9vQcW'></tfoot>

        asp:repeater - 部分更改的标题

        asp:repeater - headers at section change(asp:repeater - 部分更改的标题)

        1. <small id='Wh38k'></small><noframes id='Wh38k'>

          <i id='Wh38k'><tr id='Wh38k'><dt id='Wh38k'><q id='Wh38k'><span id='Wh38k'><b id='Wh38k'><form id='Wh38k'><ins id='Wh38k'></ins><ul id='Wh38k'></ul><sub id='Wh38k'></sub></form><legend id='Wh38k'></legend><bdo id='Wh38k'><pre id='Wh38k'><center id='Wh38k'></center></pre></bdo></b><th id='Wh38k'></th></span></q></dt></tr></i><div id='Wh38k'><tfoot id='Wh38k'></tfoot><dl id='Wh38k'><fieldset id='Wh38k'></fieldset></dl></div>

            <tfoot id='Wh38k'></tfoot>
                <tbody id='Wh38k'></tbody>
              • <legend id='Wh38k'><style id='Wh38k'><dir id='Wh38k'><q id='Wh38k'></q></dir></style></legend>
                  <bdo id='Wh38k'></bdo><ul id='Wh38k'></ul>

                  本文介绍了asp:repeater - 部分更改的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  有没有办法在数据绑定 asp:repeater 控件中的字段更改时显示子标题行,例如

                  代替

                  <上一页>国家 |颜色 |数字英国 |红色 |3英国 |绿色 |3法国| 家企业红3

                  这样做:

                  <上一页>==英国==颜色 |数字红色 |3绿色 3==法国==颜色 |数字红色 |3

                  非常感谢您的帮助.

                  解决方案

                  dotnetjunkies 代码中似乎有一些错误,但我在这里找到了一个更简单的解决方案 http://www.west-wind.com/weblog/posts/140753.aspx

                  现在中继器不支持分组,所以你必须自己做这件事,但这很容易做到.在上面的转发器中,以下数据表达式负责分组:

                  <%# this.RenderGroup(Eval("Group") as字符串) %>

                  表达式调用表单上的一个方法来呈现一个额外的 div 标签.这个简单方法的代码如下所示:

                  string LastGroup = "@#@~";受保护的字符串渲染组(字符串组){如果(组 == this.LastGroup)返回 "";//*** 组已更改this.LastGroup = 组;return "<div class='groupheader'>"+组+</div>";}

                  每个项目都会调用此代码,它只是检查组是否已更改.如果没有返回任何内容,否则返回一个简单的 div 标签作为字符串嵌入到标记中.我选择发回 HTML,但我想你也可以返回 true 或 false 并有条件地在 Repeater 中渲染一个控件,这将使 CSS Nazis 更快乐.

                  is there any way to bring up a subheader row at changes in a field in an databound asp:repeater control e.g.

                  Instead of

                  country | colour | number
                  uk | red | 3
                  uk | green | 3
                  france | red 3

                  Do this:

                  ==UK==
                  colour | number
                  red | 3
                  green 3
                  ==FRANCE==
                  colour | number
                  red | 3

                  Many thanks for any help.

                  解决方案

                  There seem to be a few bugs in the dotnetjunkies code but I've found a much simpler solution here http://www.west-wind.com/weblog/posts/140753.aspx

                  Now repeaters don't support grouping, so you have to do this on your own, but it's pretty easy to do. In the repeater above the following data expression is responsible for the grouping:

                  <%# this.RenderGroup(Eval("Group") as
                  string) %> 
                  

                  The expression calls a method on the form to render an extra div tag. The code for this simple method looks like this:

                  string LastGroup = "@#@~";
                  protected string RenderGroup(string Group) {   
                      if (Group == this.LastGroup)       
                      return "";     // *** Group has changed    
                      this.LastGroup = Group;    
                      return "<div class='groupheader'>" +Group + "</div>";
                  }
                  

                  This code gets called for every item and it simply checks to see if the group has changed. If it hasn't nothing is returned otherwise a simple div tag is returned as a string to embed into the markup. I chose to send back the HTML but I suppose you could also return true or false and conditionally render a control in the Repeater which would make the CSS Nazis happier .

                  这篇关于asp:repeater - 部分更改的标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  JSON.Net custom contract serialization and Collections(JSON.Net 自定义合约序列化和集合)
                  c# JSON Serialization Use Value Instead of Property Name(c# JSON序列化使用值而不是属性名)
                  Automatically bind pascal case c# model from snake case JSON in WebApi(从 WebApi 中的蛇案例 JSON 自动绑定帕斯卡案例 c# 模型)
                  #39;Could not load type #39;Microsoft.AspNetCore.Mvc.MvcJsonOptions#39; from assembly #39;Microsoft.AspNetCore.Mvc.Formatters.Json, Version=3.0.0.0(无法从程序集Microsoft.AspNetCore.Mvc.Formatters.Json 加载类型Microsoft.AspNetCore.Mvc.MvcJso
                  json.net; serialize entity framework object (circular reference error)(json.net;序列化实体框架对象(循环引用错误))
                  How can I use the latest VB.NET language level in an ASP.NET web site project?(如何在 ASP.NET 网站项目中使用最新的 VB.NET 语言级别?)

                  1. <tfoot id='kBMGI'></tfoot>

                        <legend id='kBMGI'><style id='kBMGI'><dir id='kBMGI'><q id='kBMGI'></q></dir></style></legend>
                          <tbody id='kBMGI'></tbody>
                        • <bdo id='kBMGI'></bdo><ul id='kBMGI'></ul>
                        • <i id='kBMGI'><tr id='kBMGI'><dt id='kBMGI'><q id='kBMGI'><span id='kBMGI'><b id='kBMGI'><form id='kBMGI'><ins id='kBMGI'></ins><ul id='kBMGI'></ul><sub id='kBMGI'></sub></form><legend id='kBMGI'></legend><bdo id='kBMGI'><pre id='kBMGI'><center id='kBMGI'></center></pre></bdo></b><th id='kBMGI'></th></span></q></dt></tr></i><div id='kBMGI'><tfoot id='kBMGI'></tfoot><dl id='kBMGI'><fieldset id='kBMGI'></fieldset></dl></div>

                            <small id='kBMGI'></small><noframes id='kBMGI'>