Solved

Call text input boxes from linkbutton

Posted on 2008-06-13
5
225 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

912 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

19 Experts available now in Live!

Get 1:1 Help Now