私のオンラインショッピングカートプロジェクトの問題に直面しています.... 問題は、テキストボックスの値が表示されている理由リピータ内のTextBoxにアクセスするとヌルが表示される
protected void repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "addtoCartName") { foreach (RepeaterItem item in repeater1.Items) { TextBox txtName = (TextBox)item.FindControl("txtQuantity"); if (txtName!= null) { strText = strText + ", " + txtName.Text; Response.Write("Text =" + strText); } } }
がASPX:
リピータ制御... は、私は後ろの
コードをコードの下に、これを使用しますが、それはnull値を示したよりも私はそのテキストボックスにいくつかの値を入力したときに....
<asp:Button runat="server" ID="addtoCart" Text="Add to Cart" CommandName="addtoCartName" UseSubmitBehavior="false" />
0あなたはそれが正しい行のテキストボックスコントロールにアクセスしています確認することができないような問題を引き起こしている おかげで私は、Repeaterコントロールをループ思う
txtQuantityは別のコンテナに配置されていますか?あなたの質問にaspx情報を拡張します。 –
私は { 文字列のpid =場合、Request.QueryString [「PID」] plzはそれをチェック – Heartlion
@Heartlion場合はどのようにあなたが ' – Webruster