取DataList数据绑定text的值问题~
我用DataList弄出了上面图的效果,下面那个数字是我用text绑定读出来的id~
现在问题是 我怎么点订购 之后把那个 text里面id值读到后台啊~
用下面的代码能在页面上显示出所有的,但是 怎么读取哪个是我选中的啊?
foreach (System.Web.UI.WebControls.DataListItem dl in this.dltcard.Items)
{
TextBox myText = (TextBox)dl.FindControl("TextBox1");
strypid = myText.Text;
Response.Write(strypid + "<br/>");
}
前台
<asp:DataList id="dltcard" RepeatColumns="2" Runat="server" Width="100%">
<ItemTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td style="width: 100px; height: 89px;"><a href="showinfo.aspx?id=<%#DataBinder.Eval(Container.DataItem,"ypbh") %>&name=<%#DataBinder.Eval(Container.DataItem,"ypmc") %>" target="_blank" title="<%#DataBinder.Eval(Container.DataItem,"ypmc") %>" style=" width:100%; height:25px;"><img alt="" src="images/20070830L9MR311CU165.jpg" style="border: 0px; width:100px; height:82px" /></a>
<asp:TextBox ID="TextBox1" runat="server" Width="100px" Height="20px" Text='<%#DataBinder.Eval(Container.DataItem,"ypbh") %>'></asp:TextBox></td>
<td style="height: 89px"><table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr><td align="left" class="body"> <a href="showinfo.aspx?id=<%#DataBinder.Eval(Container.DataItem,"ypbh") %>&name=<%#DataBinder.Eval(Container.DataItem,"ypmc") %>" target="_blank" title="<%#DataBinder.Eval(Container.DataItem,"ypmc") %>" style=" width:100%; height:25px;">
<%#Functions.GetShortTitle(DataBinder.Eval(Container.DataItem, "ypmc"), 42) %></a></td>
</tr>
<tr><td align="left" class="body"> 市场价:¥<%#Functions.GetShortTitle(DataBinder.Eval(Container.DataItem, "dj"), 42) %></td>
</tr>
<tr><td align="left" class="body"> 网上价:¥<%#Functions.GetShortTitle(DataBinder.Eval(Container.DataItem, "jj"), 42) %></td>
</tr>
<tr><td align="center">
<a href="showinfo.aspx?id=<%#DataBinder.Eval(Container.DataItem,"ypbh") %>&name=<%#DataBinder.Eval(Container.DataItem,"ypmc") %>" target="_blank" title="<%#DataBinder.Eval(Container.DataItem,"ypmc") %>" style=" width:100%; height:25px;">
<asp:Image ID="Image1" runat="server" ImageUrl="~