Repeater片段

1.字段过长截取字符串

1.1 截取字符串类

 

可以直接substring
也可以<%# Utility.Common.GetShow( Eval("NewTitle").ToString(),20,true) %><td><%#fcwms.Common.GetContent.GetShow(Eval("com_address").ToString(), 19, true)%> </td>/// <summary >/// 按字节数截取字符串,中文算两个字节,全角字符算两个字节,大写字母也算两个字节/// </summary >/// <param name="strSrc">要处理的字符串</param>/// <param name="count">要保留的字节数</param>/// <param name="withPoint">设置截取后加不加省略号( "... ")默认的传true</param>/// <returns></returns>public static string GetStrByByteCount(string strSrc, int count, bool withPoint){Regex regex = new Regex("[\u4e00-\u9fa5]+", RegexOptions.Compiled);char[] stringChar = strSrc.ToCharArray();StringBuilder sb = new StringBuilder();int nLength = 0;bool isCut = false;for (int i = 0; i < stringChar.Length; i++){if ((regex.IsMatch((stringChar[i]).ToString())) || (stringChar[i] > 65280 && stringChar[i] < 65375) || (stringChar[i] > 64 && stringChar[i] < 91)){nLength += 2;if (nLength > count){isCut = true;break;}sb.Append(stringChar[i]);}else{nLength = nLength + 1;if (nLength > count){isCut = true;break;}sb.Append(stringChar[i]);}}if (isCut){if (withPoint){return sb.ToString() + "...";}else{return sb.ToString();}}else{return sb.ToString();}}
View Code

 

1.2 示例

 <td><asp:Label ID="Label14" runat="server" Text='<%# fcwms.Common.GetContent.GetShow(Eval("com_address").ToString(),19,true)%>'  ToolTip='<%# Eval("com_address")%>'></asp:Label></td>

 

<td><asp:Label ID="lblMatNM" runat="server" Text='<%#Eval("matNM").ToString().Length >10?Eval ("matNM").ToString().Substring (0,10)+"...":Eval ("matNM").ToString ()%>' ToolTip ='<%#Eval("matNM")%>'></asp:Label></td>

无提示:

 <td><%#fcwms.Common.GetContent.GetShow(Eval("com_address").ToString(),19,true)%></td> 

2.时间格式化

<%# Convert.ToDateTime(Eval("time")).ToString("yyyy-MM-dd HH:mm")%> <%#string.Format("{0:yyyy-MM-dd HH:mm}", Eval("time"))%>

<%#string.Format("{0:g}",Eval("add_time"))%> 2018/4/2 15:03

3.合并单元格

 <td runat="server" id="tdName"><%#Eval("td_name")%></td> 

rptList.DataSource = pds;rptList.DataBind();//合并方法放到数据邦定之后for (int i = rptList.Items.Count - 1; i > 0; i--){HtmlTableCell oCell_Previous = rptList.Items[i - 1].FindControl("tdName") as HtmlTableCell;HtmlTableCell oCell = rptList.Items[i].FindControl("tdName") as HtmlTableCell;oCell.RowSpan = (oCell.RowSpan == -1) ? 1 : oCell.RowSpan;oCell_Previous.RowSpan = (oCell_Previous.RowSpan == -1) ? 1 : oCell_Previous.RowSpan;if (oCell.InnerText == oCell_Previous.InnerText){oCell.Visible = false;oCell_Previous.RowSpan += oCell.RowSpan;}}

 

转载于:https://www.cnblogs.com/cherudim/p/8464761.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/278407.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

谷歌浏览器的翻译功能在哪_如何在Google表格中使用AND和OR功能

谷歌浏览器的翻译功能在哪If you’ve ever wanted to check whether data from your Google Sheets spreadsheet meets certain criteria, you can use AND and OR. These logical functions give you TRUE and FALSE responses, which you can use to sort through your data.…

保存网络文章以供以后使用Instapaper阅读

Have you ever come across a bunch of great articles that you want to read online, but just don’t have the time? Today we take a look at an online service that allows you to read your articles later, either online, or on an iPhone, or eReader. 您是否曾经遇…

谷歌chrome xp_将非Google任务列表添加到Chrome

谷歌chrome xpMost people rely on a task list to help them remember what they need to do but not everyone wants one that is tied to a Google account. If you have been wanting an independent tasks list then join us as we look at the Tasks extension for Googl…

我们生活在最好的时代

2019独角兽企业重金招聘Python工程师标准>>> 没规划的人生叫拼图&#xff0c;有规划的人生叫蓝图&#xff1b; 没目标的人生叫流浪&#xff0c;有目标的人生叫航行&#xff01; 我们生活在最好的时代&#xff1a;在认知和学习机会上&#xff0c;人人平等&#xff0c…

MapReduce详解和WordCount模拟

最早接触大数据&#xff0c;常萦绕耳边的一个词「MapReduce」。它到底是什么&#xff0c;能做什么&#xff0c;原理又是什么&#xff1f;且听下文讲解。 是什么 MapReduce 即是一个编程模型&#xff0c;又是一个计算框架&#xff0c;它充分采用了分治的思想&#xff0c;将数据处…

无法创建系统映像_如何创建USB驱动器的映像

无法创建系统映像You can back up your USB drive by creating a saved image. You can then take that saved image and clone multiple USB sticks. This guide shows you how to create an image of your USB drive using Windows 10. 您可以通过创建保存的图像来备份USB驱动…

使用高级管理控制台获得对Windows Home Server的扩展访问

Windows Home Server is easy to setup and use so anyone with basic computer knowledge can operate their own server. But what if you’re an advanced user and want more control over various administrative functions? The Advanced Admin Console Addin gives you…

变动性算法源代码分析与使用示例(copy_backward、 transform、 replace_copy_if 等)

首先回顾前面的文章&#xff0c;我们把for_each 归类为非变动性算法&#xff0c;实际上它也可以算是变动性算法&#xff0c;取决于传入的第三个参数&#xff0c;即函数 指针。如果在函数内对容器元素做了修改&#xff0c;那么就属于变动性算法。 变动性算法源代码分析与使用示例…

如何在Outlook中的电子邮件上显示快速操作按钮

There are probably actions you regularly perform in Outlook, such as deleting, archiving, and marking things as read. Here’s how to use Quick Action buttons to add one-click options that appear over every email to perform each action. 您可能会在Outlook中定…

使用RestTemplate时报错java.lang.IllegalStateException: No instances available for 127.0.0.1

我在RestTemplate的配置类里使用了 LoadBalancedComponentpublic class RestTemplateConfig { Bean LoadBalanced public RestTemplate restTemplate(){ return new RestTemplate(); }}或者 再调用Autowiredprivate RestTemplate restTemplate;必须使用应用名作为代替ip:端口&a…

zune linux_更新您的Zune Player软件

zune linuxKeeping your computer and software up to date is very important in keeping everything running smooth and secure. It’s also important to keep your geeky gadgets updated as well. Here we take a look at updating a Zune HD. 保持计算机和软件的最新状态…

写一个简单的 django_post demo

1.新建一个django工程&#xff0c;其路由为下图 2.要做的是一个 简单的登录请求&#xff0c;以表单形式提交&#xff0c;html 部分代码如下 这里注意action指向的是路由的地址&#xff0c;index1后的views.login部分代码如下 这段代码指的是&#xff0c;如果login接收到的请求是…

日志收集

2019独角兽企业重金招聘Python工程师标准>>> ELK (ElasticSearch、Logstash、Kibana)&#xff1a; https://my.oschina.net/itblog/blog/547250 转载于:https://my.oschina.net/zfscofield/blog/1625703

autocopy2u_借助AutoCopy简化Firefox中的文本复制和粘贴

autocopy2uLooking for an easy way to speed up copying and pasting in Firefox? Now you can reduce the amount of work that you have to do by half with AutoCopy. 是否在寻找一种简便的方法来加快Firefox中的复制和粘贴&#xff1f; 现在&#xff0c;您可以使用自动复…

僵尸进程处理方式

Linux服务器上&#xff0c;多少会出现一些僵尸进程&#xff0c;下面介绍如何快速寻找和消灭这些僵尸进程的方法 首先&#xff0c;我们可以用top命令来查看服务器当前是否有僵尸进程&#xff0c;在下图中可以看到僵尸进程数的提示&#xff0c;如果数字大于0&#xff0c;那么意味…

chromebook刷机_如何查看Chromebook的停产日期

chromebook刷机Google谷歌There comes a time in your Chromebook’s life when it no longer receives updates from Google. It’s inevitable and could be a lot sooner than you think. Here’s how to see your Chromebook’s scheduled end-of-life date. Chromebook一生…

如何在Google文档中的图片周围换行

If you want to insert an image or object into a document, it’s relatively simple. However, positioning and getting them to stay where you want can be frustrating. The wrap text feature in Google Docs makes all of this more manageable. 如果要将图像或对象插…

如何在Linux上使用history命令

Fatmawati Achmad Zaenuri/ShutterstockFatmawati Achmad Zaenuri / ShutterstockLinux’s shell saves a history of the commands you run, and you can search it to repeat commands you’ve run in the past. Once you understand the Linux history command and how to u…

mysql导入sqlserver数据库表

原文&#xff1a;https://zhidao.baidu.com/question/1114325744502691499.html 在Navicat for MySQL 管理器中&#xff0c;创建目标数据库(注意&#xff1a;因为是点对点的数据导入&#xff0c;要求sql server 中要导出的数据库名称和要导入到Mysql 中的数据库的名字相同)点击…

mac自带邮箱导出邮件_如何将电子邮件从Mac Mail导出到Notes应用程序

mac自带邮箱导出邮件Khamosh PathakKhamosh PathakIf you use the Mail app regularly, you’re used to archiving or flagging emails for later. But what if you want to save a particular message for future reference in the Notes app? Well, there’s a work-around…