不知道为什么,我在使用datalist显示数据库的纪录的时候总是隔一条显示一条? 不知道为什么,我在使用datalist显示数据库的纪录的时候总是隔一条显示一条? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你是不是用datareader绑定数据的,用dataset做数据源试一试 html如下:<asp:datalist id="score" runat="server" Width="700" Height="80px"><HeaderTemplate><font face="宋体"><table width="700" border="0"><tr><td width="191">产品图片</td><td width="254">标题/公司信息</td><td width="301">诚信会员</td></tr></table></font></HeaderTemplate><EditItemStyle BackColor="Yellow"></EditItemStyle><SelectedItemTemplate><FONT face="宋体"></FONT></SelectedItemTemplate><AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle><FooterTemplate><font face="宋体"></font></FooterTemplate><ItemTemplate><TABLE width="700" border="0"><TR><TD width="191" rowSpan="3"><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><A href='TradeDetail.aspx?id=<%# DataBinder.Eval(Container.DataItem,"id").ToString() %>' target=_blank><%# DataBinder.Eval(Container.DataItem,"name") %></A></TD><TD width="254">公司负责人<%# DataBinder.Eval(Container.DataItem,"f_name") %></TD><TD width="301" rowSpan="3"><%# DataBinder.Eval(Container.DataItem,"gs_name") %><FONT face="宋体"></FONT></TD></TR><TR><TD><%# DataBinder.Eval(Container.DataItem,"gs_name") %><FONT face="宋体"></FONT></TD></TR><TR><TD>发布时间<%# DataBinder.Eval(Container.DataItem,"fbtime") %></TD></TR></TABLE></ItemTemplate><HeaderStyle BackColor="#AAAADD"></HeaderStyle><AlternatingItemTemplate><FONT face="宋体"></FONT></AlternatingItemTemplate></asp:datalist>cs文件如下:ICollection CreateSource() { int StartIndex; string type_d=Request.QueryString["type_d"].ToString();//设定导入的起终地址 StartIndex = CurrentPage*PageSize; string strSel = "select cp.id,cp.gongsi_id,cp.gs_name,cp.name,cp.fbtime,users.f_name from cp left join users on cp.gongsi_id=users.pkid";// where hylb_d= '"+type_d+"'"; SqlConnection sqlConnection=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["msdsn"]);DataSet ds = new DataSet(); SqlDataAdapter MyAdapter = new SqlDataAdapter(strSel,sqlConnection); MyAdapter.Fill(ds,StartIndex,PageSize,"cp"); return ds.Tables["cp"].DefaultView; } <AlternatingItemTemplate><FONT face="宋体"></FONT></AlternatingItemTemplate>去掉 to: LoveCherry(最讨厌你们这些要代码的了,一点技术含量都没有)<AlternatingItemTemplate><FONT face="宋体"></FONT></AlternatingItemTemplate>请教,这个是什么意思?(我是从其他地方直接考过来的代码,所以不知道是什么) <AlternatingItemTemplate><FONT face="宋体"></FONT></AlternatingItemTemplate>请教,这个是什么意思?(我是从其他地方直接考过来的代码,所以不知道是什么)-----------------------------------------------------------------------------〉交替行的意思:即2468...行 也就是交替显示的意思你可以测试一下,把数据也邦定到<AlternatingItemTemplate><FONT face="宋体"></FONT></AlternatingItemTemplate>里面,并且设置成不同的样式就会显示123456这样,1,3,5的样式是相同的,2,4,6是另一种样式 to: LoveCherry(最讨厌你们这些要代码的了,一点技术含量都没有)to: noyester(继续是菜鸟)to: AllenTing(我爱吃醋)谢谢! 下面这段代码起什么作用啊 弱弱的问个问题 关于asp.net中使用jqery的$.ajax()回传问题 请大家帮忙给网站提些建议!~ 100分求用JavaScript遍历GridView模板列控件 现在的老板怎么想的,两三个人就想在三个月内做一个进销存+财务的软件? 请教:页面被刷新后重新定位的问题。 网络克隆 web程序无法访问,请问iis的安全设置具体怎么弄?在线急等! 高分求救-在ASP.NET中类似QQ菜单动态加载的导航菜单 我不小气也不保守,我只想说一说!!! 关于Web.config问题。(分不够再加,在线等)
<asp:datalist id="score" runat="server" Width="700" Height="80px">
<HeaderTemplate>
<font face="宋体">
<table width="700" border="0">
<tr>
<td width="191">产品图片</td>
<td width="254">标题/公司信息</td>
<td width="301">诚信会员</td>
</tr>
</table>
</font>
</HeaderTemplate>
<EditItemStyle BackColor="Yellow"></EditItemStyle>
<SelectedItemTemplate>
<FONT face="宋体"></FONT>
</SelectedItemTemplate>
<AlternatingItemStyle BackColor="Gainsboro"></AlternatingItemStyle>
<FooterTemplate>
<font face="宋体"></font>
</FooterTemplate>
<ItemTemplate>
<TABLE width="700" border="0">
<TR>
<TD width="191" rowSpan="3"><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><FONT face="宋体"></FONT><A href='TradeDetail.aspx?id=<%# DataBinder.Eval(Container.DataItem,"id").ToString() %>' target=_blank><%# DataBinder.Eval(Container.DataItem,"name") %></A></TD>
<TD width="254">公司负责人<%# DataBinder.Eval(Container.DataItem,"f_name") %></TD>
<TD width="301" rowSpan="3"><%# DataBinder.Eval(Container.DataItem,"gs_name") %><FONT face="宋体"></FONT></TD>
</TR>
<TR>
<TD><%# DataBinder.Eval(Container.DataItem,"gs_name") %><FONT face="宋体"></FONT></TD>
</TR>
<TR>
<TD>发布时间<%# DataBinder.Eval(Container.DataItem,"fbtime") %></TD>
</TR>
</TABLE>
</ItemTemplate>
<HeaderStyle BackColor="#AAAADD"></HeaderStyle>
<AlternatingItemTemplate>
<FONT face="宋体"></FONT>
</AlternatingItemTemplate>
</asp:datalist>
cs文件如下:
ICollection CreateSource()
{ int StartIndex;
string type_d=Request.QueryString["type_d"].ToString();
//设定导入的起终地址
StartIndex = CurrentPage*PageSize;
string strSel = "select cp.id,cp.gongsi_id,cp.gs_name,cp.name,cp.fbtime,users.f_name from cp left join users on cp.gongsi_id=users.pkid";// where hylb_d= '"+type_d+"'";
SqlConnection sqlConnection=new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["msdsn"]);
DataSet ds = new DataSet();
SqlDataAdapter MyAdapter = new SqlDataAdapter(strSel,sqlConnection);
MyAdapter.Fill(ds,StartIndex,PageSize,"cp");
return ds.Tables["cp"].DefaultView;
}
<FONT face="宋体"></FONT>
</AlternatingItemTemplate>
去掉
<FONT face="宋体"></FONT>
</AlternatingItemTemplate>
请教,这个是什么意思?(我是从其他地方直接考过来的代码,所以不知道是什么)
<FONT face="宋体"></FONT>
</AlternatingItemTemplate>
请教,这个是什么意思?(我是从其他地方直接考过来的代码,所以不知道是什么)
-----------------------------------------------------------------------------〉
交替行的意思:即2468...行
你可以测试一下,把数据也邦定到
<AlternatingItemTemplate>
<FONT face="宋体"></FONT>
</AlternatingItemTemplate>
里面,并且设置成不同的样式
就会显示
1
2
3
4
5
6这样,1,3,5的样式是相同的,2,4,6是另一种样式
to: noyester(继续是菜鸟)
to: AllenTing(我爱吃醋)谢谢!