Repeater中,寻找TextBox,Lable.等的值

 

ASPX
<asp:Repeater ID="reLibData" runat="server"
onitemcommand
="reLibData_ItemCommand">
<ItemTemplate>
<!--show td-->
<td style=" padding:5px">
<div class="talStyle">
<table width="100%" border="0" cellspacing="1" cellpadding="2" style="font-size:12px">
<tr>
<td>需求数量</td>
<td><%#Eval("reserverenum")%></td>
</tr>

<tr>
<td>库存数量</td>
<td><asp:Label ID="labSaNum" runat="server" Text='<%#Eval("reserverenum")%>' ></asp:Label></td>
</tr>
<tr>
<td>出库数量</td>
<td><asp:TextBox ID="txtLibOutNum" runat="server" Width="30" MaxLength="4"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegExtxtLibOutNum" ControlToValidate="txtLibOutNum"
runat
="server" ValidationExpression="^[1-9][0-9]*$" ErrorMessage="请输入大于0的数."></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td align="center" align="center" colspan="2"><asp:LinkButton ID="lnkLibOut" runat="server" Text="出 库" CommandArgument='<%#Eval("reserve_goods_id")%>' CommandName="comLibOut"></asp:LinkButton> &nbsp;&nbsp;<a href="###" onclick="updateData(<%#Eval("reserveid") %>)"> 查看订单 </a> </td>
</tr>
</table>
</div>
</td>
<!--end one show-->
<%#( (Container.ItemIndex+1)%5 ==0)?"</tr><tr>":"" %>
</ItemTemplate>
</asp:Repeater>

 

 

 

CS
protected void reLibData_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "comLibOut")
{
Helper.Page.MsgShow(
this, e.CommandArgument.ToString());
TextBox _txtnum
= (TextBox)reLibData.Items[e.Item.ItemIndex].FindControl("txtLibOutNum"); //出库数量
int _liboutnum = Convert.ToInt32(_txtnum.Text.ToString() == "" ? "0" : _txtnum.Text.ToString() );
if (_liboutnum<1)
{
Helper.Page.MsgShow(
this, "请输入一个大于0的数.");
return;
}
Label _labsanum
= (Label)reLibData.Items[e.Item.ItemIndex].FindControl("labSaNum"); //库存数量
int _datasavenum = Convert.ToInt32(_labsanum.Text.ToString());
}
}

 

 

posted @ 2010-05-06 15:25  eastday  阅读(527)  评论(0编辑  收藏  举报