問題
取得 DataList裡樣板的Label值
解決方法
aspx
<asp:datalist id="objDataList" runat="server" RepeatDirection="Horizontal"> <ItemTemplate> <asp:Label id=lblCustName runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "custname") %>'></asp:Label> </ItemTemplate> </asp:datalist>vb
dim lblCustName as Label dim txtMsg as String=string.empty For i As Integer = 0 To objDataList.Items.Count - 1 lblCustName = objDataList.Items(i).FindControl("lblCustName") txtMsg = lblCustName.Text Next
沒有留言:
張貼留言