Solved

Call text input boxes from linkbutton

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

707 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