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.…

Reptile:requests + Xpath 爬取段子网的段子

2019/1/24 中午路飞学成 爬虫课程 实验及笔记。 Xpath是路飞爬虫课程中老师说的三种解析方式之一&#xff0c;前面是re正则表达式的解析方式&#xff0c;现在是xpath的解析方式&#xff0c;后面还有一个是bs4的解析方式。 re其实我理解的很困难&#xff0c;而且到现在都还不怎么…

Android 系统权限

Android 是一个权限分隔的操作系统&#xff0c;其中每个应用都有其独特的系统标识&#xff08;Linux 用户 ID 和组 ID&#xff09;。系统各部分也分隔为不同的标识。Linux 据此将不同的应用之间、应用与系统之间分隔开来 ##一、安全架构 Android 安全架构的中心设计点是&#x…

【转载】负数的二进制

https://jingyan.baidu.com/article/29697b9106eb52ab21de3c7a.html 将十进制的负数变成二进制数的过程&#xff1a; 1.写出绝对值的二进制码&#xff08;原码&#xff09; 2.取反&#xff08;反码&#xff09; 3.1,&#xff08;补码&#xff09; 同理&#xff0c;将二进制的负…

保存网络文章以供以后使用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…

学习笔记 - MarkDown 语法

学习参考网址&#xff1a;https://www.appinn.com/markdown/index.html # **gitskill**## 标题 ># 这是 H1 >## 这是 H2 >###### 这是 H6## 区块引用 Blockquotes > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet, consectetuer adipisci…

[BZOJ4671]异或图

description BZOJ 定义两个结点数相同的图\(G1\)与图\(G2\)的异或为一个新的图\(G\), 其中如果\((u,v)\)在\(G1\)与\(G2\)中的出现次数之和为\(1\), 那么边\((u,v)\)在\(G\)中, 否则这条边不在\(G\)中. 现在给定\(s\)个结点数相同的图\(G1...s\),设\(S{G1,G2,...,Gs},\) 问\(S\…

我们生活在最好的时代

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驱动…

UGUI事件之Drag拖拽事件

UI事件之Drag拖拽事件2.UGUI 事件命名空间   当我们需要使用 UGUI 中的事件的时候&#xff0c;需要在脚本内引入专有命名空间&#xff1a;   using UnityEngine.EventSystems;----------------------------------2.拖拽相关事件接口----------------------------------1.三…

java 通过cookie判断是否登陆

protected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {// 判断cookie是否有登录信息Cookie[] cookies req.getCookies();boolean isLogin false;for(Cookie c : cookies){if("loginInfo".equals(c.getNa…

使用高级管理控制台获得对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;那么就属于变动性算法。 变动性算法源代码分析与使用示例…

[转]QDir类及其用法总结

直接给出原文链接&#xff1a;QDir类及其用法总结 转载于:https://www.cnblogs.com/rainbow70626/p/10330643.html

如何在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中定…

c++读取和写入TXT文件的整理

c读取和写入TXT文件的整理 #include "stdafx.h" #include <iostream> //无论读写都要包含<fstream>头文件 #include <fstream> #include <iomanip> using namespace std;int main() {//ifstream从文件流向内存的ifstream表示文件输入流…

使用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…

sh变量特性(3)默认特性

变量说明$0当前脚本的文件名$n传递给脚本或函数的参数&#xff0c;n是数字&#xff0c;第n个参数$#传递给脚本或函数的参数个数$*传递给脚本或函数的所有参数$传递给脚本或函数的所有参数。被””包含时&#xff0c;与$*稍有不同$?上个命令的退出状态&#xff0c;或函数返回值…