<%# Eval("UserId") %>
2条回答 默认 最新
- q107770540 2014-12-07 08:56关注
<tr id="producttitle"> <asp:Label ID="Label1" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "vcproduct_title")%>' /> </tr> protected void Add_Click(object sender, EventArgs e) { System.Web.UI.WebControls.Button btn = sender as System.Web.UI.WebControls.Button; if (btn != null) { //string title = btn.CommandArgument.ToString(); DataListItem item = btn.NamingContainer as DataListItem; if (item != null) { //find the Label and get the text: Label lbl= item.FindControl("Label1") as Label; string title = lbl.Text.ToString(); } } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报