Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Call text input boxes from linkbutton

Posted on 2008-06-13
5
Medium Priority
?
234 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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 …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

604 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