Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add user input from textbox into an array or arraylist
    primarykey
    data
    text
    <p>I am creating a gift card application where the user inputs the recipients information into textbox. The app allows the user to add another gift card(up to 5 times). I am trying to find a way to add the textbox input into an array or arrayList that I can call later and display that info in their "shopping cart". The app is in C# with a webform platform in Visual Studio 2012. So far, for the arraList, I have:</p> <pre><code>private ArrayList arrayList = new ArrayList(); protected void Page_Load(object sender, EventArgs e) { } protected void btnEnter_Click(object sender, EventArgs e) { arrayList.Add(txtFName.Text); if (arrayList.Count == 1) { lblFName.Text = arrayList[0].ToString(); } if (arrayList.Count == 2) { lblFName.Text = arrayList[0].ToString(); lblFName1.Text = arrayList[1].ToString(); } } </code></pre> <p>I believe I just need a way to increment the input into the array but I cannot figure out how to do it. Any help or suggestions on another avenue to take would be deeply apreciated</p> <p>Here is the code for the recipient info panel as well as the panel for the Cart. // <h2>Recipient Information:</h2> <p>The name of the person that will receive the Visa Prepaid Card is required. The name will appear on the card.</p> *First Name: <br /> <br /> Middle Initial: <br /> <br /> *Last Name: <br /> <br /> Suffix: Jr. Sr. II III IV &nbsp;&nbsp;&nbsp; <br /> <br /> The combination of first name, middle initial, last name, and suffix cannot exceed 26 characters.<br /> <br /> <h2>Gift Card Information:</h2> <br /> Must be a whole amount between $25.00 and $500.00, without a dollar sign or decimal. <br /> <br /> *Enter Amount: <br /> <br /> Personalized Message: All the Best Bon Voyage Congratulations Congratulations Grad Good Luck Happy Anniversary Happy Birthday Have Fun Just Because Just Married Merry Christmas Seasons Greetings Thank You <br /> <br /> <b>Or Choose</b>&nbsp;&nbsp;&nbsp; <br /> Custom Message: <br /> <br /> <br /> <br /> <ul> <li>CANCEL</li> <li> BACK</li> <li> CONTINUE</li> </ul> //</p> <pre><code> //&lt;asp:Panel ID="pnlCart" runat="server" Width="100%" Visible="false"&gt; &lt;asp:Panel ID="Panel1" runat="server" GroupingText="Card Choice 1" ForeColor="DarkBlue" Font-Bold="True" BorderStyle="NotSet" BorderColor="#E0E0E0"&gt; &lt;div class="container"&gt; &lt;div class="pair"&gt; &lt;div class="labelLeftBold"&gt; Amount: &lt;/div&gt; &lt;div class="fieldRight"&gt; &lt;asp:Label ID="lblCartAmount" runat="server" Font-Bold="true"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;div class="labelLeftBold"&gt; Card Design: &lt;/div&gt; &lt;div class="imgCard"&gt; &lt;asp:Image ID="imgCardChoice1" runat="server" /&gt; &lt;/div&gt; &lt;div class="fieldRight"&gt; &lt;asp:Label ID="lblCartDesign" runat="server" Font-Bold="true"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;div class="labelLeftBold"&gt; Name on Card: &lt;/div&gt; &lt;div class="fieldRight"&gt; &lt;asp:Label ID="lblCartName" runat="server" Font-Bold="true"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;div class="labelLeftBold"&gt; Message on Card: &lt;/div&gt; &lt;div class="fieldRight"&gt; &lt;asp:Label ID="lblCartMessage" runat="server" Font-Bold="true"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/asp:Panel&gt; &lt;br /&gt; &lt;div class="container1"&gt; &lt;asp:Panel ID="Panel2" runat="server" GroupingText="Card Choice 2" ForeColor="DarkBlue" Font-Bold="True" BorderStyle="NotSet" BorderColor="#E0E0E0"&gt; &lt;div class="pair"&gt; &lt;br /&gt; &lt;div class="labelLeftBold"&gt; Amount: &lt;/div&gt; &lt;div class="fieldRight"&gt; &lt;asp:Label ID="lblCartAmount1" runat="server" Font-Bold="true"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;div class="labelLeftBold"&gt; Card Design: &lt;/div&gt; &lt;div class="imgCard"&gt; &lt;asp:Image ID="imgCardChoice2" runat="server" /&gt; &lt;/div&gt; &lt;div class="fieldRight"&gt; &lt;asp:Label ID="lblCartDesign1" runat="server" Font-Bold="true"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;div class="labelLeftBold"&gt; Name on Card: &lt;/div&gt; &lt;div class="fieldRight"&gt; &lt;asp:Label ID="lblCartName1" runat="server" Font-Bold="true"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;div class="labelLeftBold"&gt; Message on Card: &lt;/div&gt; &lt;div class="fieldRight"&gt; &lt;asp:Label ID="lblCartMessage1" runat="server" Font-Bold="true"&gt;&lt;/asp:Label&gt; &lt;/div&gt; &lt;br /&gt; &lt;br /&gt; &lt;/div&gt; // &lt;/asp:Panel&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload