昊仔

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::

随笔分类 -  Repeater控件的使用

摘要:我在REPEATER控件中显示绑定的数据,但有的字符串长度较长,超出了定义的行宽,如果只想显示字符串的部分内容,如何实现. 代码如下: " target=_blank> 答案一public string GetChar( string str , int len ) { /// if( str.Length > len ) { str = str.Substring( 0, len ); str = str + "..."; return str; } else ... 阅读全文
posted @ 2013-11-24 20:55 昊仔 阅读(419) 评论(0) 推荐(0)

摘要:无标题页 ":""%> " : ""%> ":""%> " : ""%> [code=C#] protected int HorizontalCount = 4; private DataTable GetDataSource() { DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("Name")); DataRow dr; for (int i = 0; 阅读全文
posted @ 2013-11-23 16:15 昊仔 阅读(527) 评论(0) 推荐(0)

摘要:<asp:Repeater ID="Repeater1" runat="server"><ItemTemplate><ul style="float:left"><img src="Images/dian.gif"><a href="#"><%#Eval("Title") %></a></ul></ItemTemplate><AlternatingItemTemp 阅读全文
posted @ 2013-06-17 17:32 昊仔 阅读(403) 评论(0) 推荐(0)

摘要:有时候我们希望让数据库中的多行记录用一行来显示,比如每5个记录行合并为一行显示。这里用Repeater绑定数据显示为例(又是Repeater,怎么样,他的威力不同一般吧。真的是爱死他了。)我这里有两种方法,经过测试,都成功了。第一种方法:没得说,首先推荐最简单的一种方法。代码如下:<div style="width:1000px;"><asp:Repeater ID="filenamelist_repeater" runat="server"><headertemplate></headert 阅读全文
posted @ 2013-06-17 17:31 昊仔 阅读(326) 评论(0) 推荐(0)

摘要:我知道的两种方法,其实都一样!1、public partial class repeater获取控件 : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName.Equals("get")) { Button button = Repeater1.Controls[Repeater 阅读全文
posted @ 2013-06-03 21:05 昊仔 阅读(405) 评论(0) 推荐(0)

摘要:for (int i = Repeater2.Items.Count - 1; i > 0; i--){HtmlTableCell oCell_previous = Repeater2.Items[i - 1].FindControl("f_Type") as HtmlTableCell;HtmlTableCell oCell = Repeater2.Items[i].FindControl("f_Type") as HtmlTableCell;oCell.RowSpan = (oCell.RowSpan == -1) ? 1 : oCell.Ro 阅读全文
posted @ 2013-06-03 20:52 昊仔 阅读(133) 评论(0) 推荐(0)