C#如何实现Label控件绑定字段并且显示内容

ahjdtjh 2013-03-11 01:46:51
我想用两个asp:Label控件来绑定数据库中atblLeadsWiki中的DescriptionBrief、DescriptionComplete这两个字段,这个两个控件的ID="Title"和ID="Description",想问一下这样的后台代码该如何去书写!各位帮忙啊!!!
 <table id="tabContent">
<tr>
<td>
<asp:Label ID="Title" runat="server"></asp:Label>
</td>
<td>
<asp:Label ID="Des" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td align="left">
<h2 style="font-weight: bold">
What's It Worth?
</h2>
</td>
<td>
<uc:EstimatedValue ID="EstimatedValue" runat="server" />
</td>
</tr>
<tr>
<td align="left">
<h2 style="font-weight: bold">
Real Market Data
</h2>
</td>
<td>
</td>
</tr>
<tr>
<td align="left">
<h2 style="font-weight: bold">
IGUIDE ABOUT US</h2>
<p style="font-weight: bold">
iGuide is an encyclopedia of antiques and collectibles, with prices. The I is for
INFO. iGuide is millions of WEB pages, each devoted to an individual object in the
Art, Antiques, Collectibles and Memorabilia fields. Dozens of categories are included
in the database, from action figures and baseball cards, comic books to movie posters,
zippo lighters, and everything in between. And we are growing! New pages are being
added daily. iGuide empowers you with price information. iGuide gives you an edge.
You'll buy smarter, and sell smarter.
</p>
<br />
<h2 style="font-weight: bold">
Visit us at<a href="http://www.iguide.net"> www.IGUIDE.NET</a></h2>
</td>
</tr>
<tr>
<td align="center">
<input id="Button1" type="button" value="Print" onclick="Print();" style="width: 100px;
height: 34px" runat="server" />
<asp:Button id="btnclose" Text="Close" runat="server" OnClick="Back" style="width: 100px;
height: 34px;" />
</td>
</tr>
</table>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.Sql;

public partial class price_guide_Print : System.Web.UI.Page
{

protected void Page_Load(object sender, EventArgs e)
{

}

protected void Back(object sender, EventArgs e)
{
Response.Redirect("Details.aspx?ItemID=" + Request.QueryString["ItemID"]);
}
}
...全文
589 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ahjdtjh 2013-03-11
  • 打赏
  • 举报
回复
我刚刚用你的办法试了一下,没有用啊!说控件中不能用构造
gxingmin 2013-03-11
  • 打赏
  • 举报
回复
<tr> <td> <asp:Label ID="Title" Text="<%=atblLeadsWiki.Rows[0]["DescriptionBrief"]%> runat="server"></asp:Label> </td> <td> <asp:Label ID="Des" Text="<%=atblLeadsWiki.Rows[0]["DescriptionComplete"]%> runat="server"></asp:Label> </td> </tr> ...

111,094

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧