通过SQL语句,比较相邻的两个月。例如比如7月的数据,用1日,2日的数据作比较为例,下面的1日,2日代表各自的数值。 select case when 1日>2日 then cast(1日 as varchar)+'<font style=''Color:red''>↑</font>' when 1日=2日 then cast(1日 as varchar)+'<font style=''Color:blue''>→</font>' else cast(1日 as varchar)+'<font style=''Color:green''>↓</font>' end [1日], case when 2日>1日 then cast(2日 as varchar)+'<font style=''Color:red''>↑</font>' when 1日=2日 then cast(2日 as varchar)+'<font style=''Color:blue''>→</font>' else cast(2日 as varchar)+'<font style=''Color:green''>↓</font>' end [2日],然后绑定数据时,直接绑定1日,2日即可
导航 三木虫草首页 | 冬虫夏草资料 | 冬虫夏草图片 | 自助服务 | 冬虫夏草价格| 联系我们
-----------------------------------------
IFRAME
--------------------------------------------
页尾关于价格走势那个页面
一个是数据录入(管理后台的部分)
然后做显示的话
TABLE那些
都是用代码画的
不是开始就在的
一个个TR TD 给组合起来的~!~
很容易的
Response.write("<table name="table>");
Response.write("<tr>");
Response.write("<td>");
Response.write("content");
Response.write("</td>");
Response.writer("</tr>");
Response.write("</table>");
页面上拖一个asp:table
以下代码红色部分为自己录入的。
protected System.Web.UI.WebControls.Table Table1;
private void Page_Load(object sender, System.EventArgs e)
{
TableRow tr=new TableRow();
for(int i=0;i<2;i++)
{
TableCell tc=new TableCell();
tc.Text=@"<font color='#FF0000'><b>↑</b></font>";
tr.Cells.Add(tc);
}
Table1.Rows.Add(tr);
Table1.BorderWidth=1; }
谢谢你的代码
=============
还有没有其他代码
那个表格一要判断月份 那个月份 目前是11月 到了12 自动出来多一列
二要判断走势 这个容易 那个月份的那个怎么弄?
通过SQL语句,比较相邻的两个月。例如比如7月的数据,用1日,2日的数据作比较为例,下面的1日,2日代表各自的数值。
select case when 1日>2日 then cast(1日 as varchar)+'<font style=''Color:red''>↑</font>'
when 1日=2日 then cast(1日 as varchar)+'<font style=''Color:blue''>→</font>'
else cast(1日 as varchar)+'<font style=''Color:green''>↓</font>' end [1日],
case when 2日>1日 then cast(2日 as varchar)+'<font style=''Color:red''>↑</font>'
when 1日=2日 then cast(2日 as varchar)+'<font style=''Color:blue''>→</font>'
else cast(2日 as varchar)+'<font style=''Color:green''>↓</font>' end [2日],然后绑定数据时,直接绑定1日,2日即可
18楼的代码购详细了,楼主你自己再动动脑筋。
TableCell tc=new TableCell(); 他这里可以new TableCell,你当然就能new TableRow啊
TableCell td=new TableCell();
td.innerHTML="";
tr.Cells.Add(td);
Table.Rows.Add(tr);
<body>
<form id="Form1" method="post" runat="server">
<asp:Label ID="Label1" Style="z-index: 101; left: 256px; position: absolute; top: 40px"
runat="server">Asp.Net Table控件动态生成表格操作实例</asp:Label>
<asp:Button ID="Button1" Style="z-index: 105; left: 272px; position: absolute; top: 120px"
runat="server" Text="生 成" OnClick="Button1_Click1"></asp:Button>
<asp:Table ID="Table1" Style="z-index: 104; left: 272px; position: absolute; top: 160px"
runat="server" GridLines="Both">
</asp:Table>
<asp:DropDownList ID="DropDownList2" Style="z-index: 103; left: 344px; position: absolute;
top: 88px" runat="server">
<asp:ListItem Value="1">1列</asp:ListItem>
<asp:ListItem Value="2">2列</asp:ListItem>
<asp:ListItem Value="3">3列</asp:ListItem>
<asp:ListItem Value="4">4列</asp:ListItem>
<asp:ListItem Value="5">5列</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="DropDownList1" Style="z-index: 102; left: 280px; position: absolute;
top: 88px" runat="server">
<asp:ListItem Value="1">1行</asp:ListItem>
<asp:ListItem Value="2">2行</asp:ListItem>
<asp:ListItem Value="3">3行</asp:ListItem>
<asp:ListItem Value="4">4行</asp:ListItem>
<asp:ListItem Value="5">5行</asp:ListItem>
</asp:DropDownList><asp:Button ID="Button2" Style="z-index: 105; left: 334px; position: absolute; top: 123px"
runat="server" Text="生 成" OnClick="Button2_Click" />
</form>
</body>
.cs
protected void Button1_Click1(object sender, EventArgs e)
{
int numrows = Convert.ToInt32(DropDownList1.SelectedValue); //行
int numcells = Convert.ToInt32(DropDownList2.SelectedValue); //列
TableRow r;
TableCell c;
//产生表格
for (int i = 0; i < numrows; i++)
{
r = new TableRow();
for (int j = 0; j < numcells; j++)
{
c = new TableCell();
c.Controls.Add(new LiteralControl("row" + j + ",cell" + i));
r.Cells.Add(c);
}
Table1.Rows.Add(r);
}
}===================
这些代码基本都有 认真分析下才知道那个页面那里难 可能是我太笨 弄不出来 那位高手帮忙弄下
================
已经换做法了 要是有兴趣的可以自己做下 就知道难不难了