Allan
菜鸟也是有梦想的...

导航

 

后台代码:

 

后台代码
1 using System;
2  using System.Collections.Generic;
3  using System.Linq;
4 using System.Web;
5 using System.Web.UI;
6 using System.Web.UI.WebControls;
7
8 namespace WebApplication1
9 {
10 public partial class _Default : System.Web.UI.Page
11 {
12 protected void Page_Load(object sender, EventArgs e)
13 {
14
15 }
16
17 protected void dlDemo_ItemDataBound(object sender, DataListItemEventArgs e)
18 {
19 //获取ID为lb1的text的内容
20 Label newlb1 = e.Item.FindControl("lb1") as Label;
21 string lbText = newlb1.Text;
22
23 }
24 }
25 }

 

 

前台代码:

 

代码
1 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4
5 <html xmlns="http://www.w3.org/1999/xhtml" >
6 <head runat="server">
7 <title></title>
8 </head>
9 <body>
10 <form id="form1" runat="server">
11 <div>
12 <asp:DataList ID="dlDemo" runat="server" onitemdatabound="dlDemo_ItemDataBound">
13 <ItemTemplate>
14 <asp:Label ID="lb1" runat="server" Text="确 认" ></asp:Label>
15 </ItemTemplate>
16 </asp:DataList>
17 </div>
18 </form>
19 </body>
20 </html>
21

 

 

posted on 2010-11-18 22:11  AllanGuan  阅读(619)  评论(0编辑  收藏  举报