Solved

Call text input boxes from linkbutton

Posted on 2008-06-13
5
224 Views
Last Modified: 2010-05-18
What I have is an asp page that users can enter batch numbers.  They need the ability to enter multiple batch numbers or just one batch number.  So my thought was to place a link button on the screen that when they click on it , it adds another textbox to enter another batch number.  Then the last part of the question would be how do I get an id of the textboxes to add back into the databases.  
0
Comment
Question by:kdeutsch
  • 3
  • 2
5 Comments
 
LVL 21

Expert Comment

by:naspinski
ID: 21780568
an easier approach (imo) would be to have users type in multiple batch numbers into one textbox, seperated by commas, spaces, semicolons (whatever really).  Then you could easily get all the values using:

TextBox.Text.Split();

It also would avoid any postback or limiting of amount of numbers you could enter like the multiple textbox approach may cause.  Or are you stuck on multiple boxes?
0
 

Author Comment

by:kdeutsch
ID: 21780597
No not at all, enter in one place would be even better.  The thing that I guess I would need to more info on is the SQL insert statement.  We call out our connections from the common.vb so alls I have to do is a simple
Update  table  so on.
How would I go about updating a textbox described above using this insert method.
Thanks
0
 
LVL 21

Expert Comment

by:naspinski
ID: 21780672
This is the approach I would take:
string[] delimiters = new string[] { " ", ",", ";" };

string[] batches = txtBatches.Text.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);

foreach (string s in batches)

    // insert into db
 

// your insert method would depend on how you access your DB

// Personally I like LINQ, but if youa re unfamiliar with that 

// I would say to go with the System.Data.SqlClient approach

Open in new window

0
 

Author Comment

by:kdeutsch
ID: 21781237
Ok here is the code I wrote but I am getting a lot of blue underlines.
The first is it says string is a class type and so not a valid expression,  foreach is not declared,
most of it is not declared statements.

Private Sub lnkSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkSubmit.Click

        string[] delimiters = new string[] { " ", ",", ";" };
        string[] batches = txtBatchNum.Text.Split(delimiters, StringSplitOptions.RemoveEmptyEntries)

        foreach (string s in batches)

        sql = "INSERT tblbatchNum (inTaskForceID, intUICid, strbatchNum) VALUES ('" & ddlTaskForce.SelectedValue & "', " _
                & "'" & DDLUIC.SelectedValue & "', '" & txtBatchNum.Text & "')"

        Response.Redirect("sadform.aspx")

    End Sub
0
 

Accepted Solution

by:
kdeutsch earned 0 total points
ID: 21874083
Solution,
I added a link button that after they put in a number they press on link its saved moved intot a listbox so they can see it and then they can enter other numbers.  1. this allows them to see what they enter right away and 2. solves my problem of entering multiple numbers while giving error correction in teh textbox.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now