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.pswp.cn/news/278407.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/278407.shtml
英文地址,請注明出處:http://en.pswp.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;或函數返回值…