显示数据排列的问题。。 DATALIST可以把数据显示成N*N样式。但是我想显示成塔式样式。怎么写比如有30个数据,绑定后,显示如下 ** **** ****** ********每行增加两个。能否实现,或者其他办法也可以。谢谢了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果有规律的增加 你可以用asp的方式来做了datalist 等是不能做到的 用自定义控件修改Render是可以实现的。 using System;using System.Web.UI;using System.Web.UI.WebControls;using System.ComponentModel;namespace newscontrol{ /// <summary> /// WebCustomControl1 的摘要说明。 /// </summary> [DefaultProperty("Text"), ToolboxData("<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")] public class WebCustomControl1 : System.Web.UI.WebControls.WebControl { private string text; [Bindable(true), Category("Appearance"), DefaultValue("")] public string Text { get { return text; } set { text = value; } } /// <summary> /// 将此控件呈现给指定的输出参数。 /// </summary> /// <param name="output"> 要写出到的 HTML 编写器 </param> protected override void Render(HtmlTextWriter output) { String s ="<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#FFCC66'"; s=s+" width='180' id='AutoNumber5'>"; s=s+" <tr><td width='100%' bgcolor='#CC6600'>"; s=s+" <img src='04/home01.gif' width='12' height='14'><a href='http://finance.sina.com.cn'><font color='#FFFFFF'>技术动态</font></a></td>"; s=s+" </tr>"; s=s+" <tr><td width='100%'>"; s=s+" <span class='F7'> ● </span><a href='http://finance.sina.com.cn/g/20040527/0712780434.shtml' target='_blank' style='color: #00007f'>"; s=s+" 银监会将对电石铁合金业</a><br>"; s=s+" <span class='F7'>● </span><a href='http://finance.sina.com.cn/t/20040527/0711780433.shtml' target='_blank' style='color: #00007f'>"; s=s+" 中小企业板今日启动</a> <a href='http://finance.sina.com.cn/e/20040527/0708780431.shtml' target='_blank' style='color: #00007f'>"; s=s+" 五只</a><br>"; s=s+" <span class='F7'>● </span><a href='http://finance.sina.com.cn/g/20040527/0801780536.shtml' target='_blank' style='color: #00007f'>"; s=s+" 三级调查组进驻湖南嘉禾</a><br>"; s=s+" <span class='F7'>● </span><a href='http://finance.sina.com.cn/roll/20040527/0636780294.shtml' target='_blank'"; s=s+" style='color: #00007f'>新退市板块开局遭腰斩</a> <a href='http://finance.sina.com.cn/roll/20040527/0612780180.shtml' target='_blank'"; s=s+" style='color: #00007f'>股</a><br>"; s=s+" <span class='F7'>● </span><a href='http://tech.sina.com.cn/i/w/2004-05-27/0828367735.shtml' target='_blank' style='color: #00007f'>"; s=s+" 纳斯达克计划扩大中国业</a><br>"; s=s+" <span class='F7'>● </span><a href='http://tech.sina.com.cn/it/2004-05-26/1039367327.shtml' target='_blank' style='color: #00007f'>"; s=s+" 微软柯达涉嫌垄断</a> <a href='http://tech.sina.com.cn/it/2004-05-27/1053367892.shtml' target='_blank' style='color: #00007f'>"; s=s+" 盖茨将</a><br>"; s=s+" <span class='F7'>● </span><a href='http://tech.sina.com.cn/it/t/2004-05-27/0854367758.shtml' target='_blank'"; s=s+" style='color: #00007f'>广东电信条例提交审议 </a>"; s=s+" <br>"; s=s+" <span class='F7'>● </span><a href='http://tech.sina.com.cn/focus/top_100co/index.shtml' target='_blank' style='color: #00007f'>"; s=s+" 电子信息百强揭晓 海尔联</a><br>"; s=s+" <span class='F7'>● </span><a href='http://tech.sina.com.cn/ology/' target='_blank' style='color: #00007f'>"; s=s+" “长城”照片新说:不</a>"; s=s+" </td></tr>"; s=s+" <tr>"; s=s+" <td width='100%'>"; s=s+" <p align='right'>"; s=s+" <a style='color: #00007f' href='http://finance.sina.com.cn'>more>>> "; s=s+" </a>"; s=s+" </td>"; s=s+" </tr>"; s=s+" </table>"; output.Write(s); } }}只是个例子,需要按你输出格式修改 编码和解码解决传送字符不全问题 用Silverlight开发需要安装什么? 求BBS主题或回复编辑器源码或是配置! 名称空间的问题! 求救:开始接触XML!!初学者,别见怪 关于页面缓存的一个棘手问题,高手帮忙啊 在asp.net 中如何同一个TCP服务器建立一个全局连接,进行数据通讯? datagrid中怎么根据某列的值,找到对应的行呢? 比较怪异的数据类型转换问题 ascx用户控件问题 一句vb语句转C# 我已经在config.web中设置了中文,为什么还是显示乱码????
datalist 等是不能做到的
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;namespace newscontrol
{
/// <summary>
/// WebCustomControl1 的摘要说明。
/// </summary>
[DefaultProperty("Text"),
ToolboxData("<{0}:WebCustomControl1 runat=server></{0}:WebCustomControl1>")]
public class WebCustomControl1 : System.Web.UI.WebControls.WebControl
{
private string text; [Bindable(true),
Category("Appearance"),
DefaultValue("")]
public string Text
{
get
{
return text;
} set
{
text = value;
}
} /// <summary>
/// 将此控件呈现给指定的输出参数。
/// </summary>
/// <param name="output"> 要写出到的 HTML 编写器 </param>
protected override void Render(HtmlTextWriter output)
{
String s ="<table border='1' cellpadding='0' cellspacing='0' style='border-collapse: collapse' bordercolor='#FFCC66'";
s=s+" width='180' id='AutoNumber5'>";
s=s+" <tr><td width='100%' bgcolor='#CC6600'>";
s=s+" <img src='04/home01.gif' width='12' height='14'><a href='http://finance.sina.com.cn'><font color='#FFFFFF'>技术动态</font></a></td>";
s=s+" </tr>";
s=s+" <tr><td width='100%'>";
s=s+" <span class='F7'> ● </span><a href='http://finance.sina.com.cn/g/20040527/0712780434.shtml' target='_blank' style='color: #00007f'>";
s=s+" 银监会将对电石铁合金业</a><br>";
s=s+" <span class='F7'>● </span><a href='http://finance.sina.com.cn/t/20040527/0711780433.shtml' target='_blank' style='color: #00007f'>";
s=s+" 中小企业板今日启动</a> <a href='http://finance.sina.com.cn/e/20040527/0708780431.shtml' target='_blank' style='color: #00007f'>";
s=s+" 五只</a><br>";
s=s+" <span class='F7'>● </span><a href='http://finance.sina.com.cn/g/20040527/0801780536.shtml' target='_blank' style='color: #00007f'>";
s=s+" 三级调查组进驻湖南嘉禾</a><br>";
s=s+" <span class='F7'>● </span><a href='http://finance.sina.com.cn/roll/20040527/0636780294.shtml' target='_blank'";
s=s+" style='color: #00007f'>新退市板块开局遭腰斩</a> <a href='http://finance.sina.com.cn/roll/20040527/0612780180.shtml' target='_blank'";
s=s+" style='color: #00007f'>股</a><br>";
s=s+" <span class='F7'>● </span><a href='http://tech.sina.com.cn/i/w/2004-05-27/0828367735.shtml' target='_blank' style='color: #00007f'>";
s=s+" 纳斯达克计划扩大中国业</a><br>";
s=s+" <span class='F7'>● </span><a href='http://tech.sina.com.cn/it/2004-05-26/1039367327.shtml' target='_blank' style='color: #00007f'>";
s=s+" 微软柯达涉嫌垄断</a> <a href='http://tech.sina.com.cn/it/2004-05-27/1053367892.shtml' target='_blank' style='color: #00007f'>";
s=s+" 盖茨将</a><br>";
s=s+" <span class='F7'>● </span><a href='http://tech.sina.com.cn/it/t/2004-05-27/0854367758.shtml' target='_blank'";
s=s+" style='color: #00007f'>广东电信条例提交审议 </a>";
s=s+" <br>";
s=s+" <span class='F7'>● </span><a href='http://tech.sina.com.cn/focus/top_100co/index.shtml' target='_blank' style='color: #00007f'>";
s=s+" 电子信息百强揭晓 海尔联</a><br>";
s=s+" <span class='F7'>● </span><a href='http://tech.sina.com.cn/ology/' target='_blank' style='color: #00007f'>";
s=s+" “长城”照片新说:不</a>";
s=s+" </td></tr>";
s=s+" <tr>";
s=s+" <td width='100%'>";
s=s+" <p align='right'>";
s=s+" <a style='color: #00007f' href='http://finance.sina.com.cn'>more>>> ";
s=s+" </a>";
s=s+" </td>";
s=s+" </tr>";
s=s+" </table>";
output.Write(s);
}
}
}
只是个例子,需要按你输出格式修改