Get values of textbox with values seperated by comma

I am trying to get a better way of entering the same data over and over, my first thought was multiple textboxews but in todays world there has to be a better way, so I thoguth i couold just add one textbox to page and they can enter all batch numbers in that textbox seperated by a comma and then I could pull them and insert them individually into the sql database.  Is this a good method or should I put a link button that they refresh the page and enter  a signle one everytime.  here is the code I have to enter it all in one text box but I get all kinds of error on it.

 

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
kldeutsch
6/16/2008 12:36:20 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

2 Replies
1433 Views

Similar Articles

[PageSpeed] 24

The method you are using is; you can say; most conventional way that is used.

I would suggest to take a look at one of the finest way to pass the delimitted list in form of xml to stored procedure and insert in to the database tables. check out complete tutorial at > Passing lists to SQL server stored procedures with example.

hope it helps./. 


Thanx,
[KaushaL] || BloG || Profile || Microsoft MVP

"I would love to change the world, but they won’t give me the source code"


Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers.
0
kaushalparik27
6/16/2008 12:46:38 PM

ha ha ha ha... sorry mate.. i couldn't resist.. as it is good..

i thought you have written in c# then i found oh no it is VB.. finally i come to knew that its amixture of both.. c# and VB.. Smile don't worrk every one do this..

SO THIS FIRST  you have to make it in one languahe.. it seems that most of your code is in c# but you are trying to write in vb as you started with vb.

second you are iterating batches in 's' but you ar enot using this variable this might be your second problem.. as you are may be using some other variable instead "s". so correct it..

FInally i don't think your method is wrong.. it depends how quick and how fast and how maintainable it is.Smile


"Mark as answered if you feel this helps you"
"Curiosity is Bliss"
Regards,

Ravi Kant Srivastava
(Sr. Software Engineer)
Connexxions Business
Mumbai
INDIA
0
blurearc
6/16/2008 12:48:38 PM
Reply:

Similar Artilces:

problem with get value from textbox after get it value in load page
hi every one  i have problem with my web site when i get textbox value in load page   and Changed textbox the page do not take last value .   it take value in load page   this is code:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)   TextBox1.Text = "aa" End SubProtected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) MsgBox(TextBox1.Text) End Sub   when i press button message write "aa" while i changed the textbox   please if enyone knowen help me &nbs...

getting values from a web form to windows form
Hot Requirement ..... Is there any possible of getting values from a web form to windows form ????? Yes One way i to use the WebRequest and WebResponse classes of the System.Net namespace. For example:  WebRequest request = WebRequest.Create("URL of the web page); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string content = reader.ReadLine(); ....    Reza Nassabehwww.professionalcsharp.comDon't forget to click "Mark as Answer" on the post that helped you. That way fut...

Losing values of Textboxes after accessing values from web.config
HelloCan someone help with me with this problem. I am accessing some values from my application's web.config in the AppSettings section and setting the text properties of the text boxes on a settings page with these values. I then edit the value of one of the text boxes. When I click the Save Changes button I lose the values of these text boxes. The code I am using is: In Page_Load:txtSMTPServerURL.Text = ConfigurationManager.AppSettings["SMTPServerURL"] In btnSaveChanges_Click:string smtpURL = txtSMTPServerURL.Text Andrew Ling Are you checking for a postback (Page.IsPost...

Getting value from a textbox control that was filled with a value from javascript
 I have a textbox control (seen below txtMileageDollars1) that gets filled with javascript based on the number of miles a user types into another textbox (txtMileageMiles1) control.  When I post back with the submit button, the value is blank.  I've tried setting EnableViewState to false, but still cannot get a value on postback.  Does anyone have a solution?   Miles<asp:TextBox ID="txtMileageMiles1" runat="server" Width="50px"></asp:TextBox>   Total (txtMileageMiles1 * rate with javascript)<asp:TextBox...

Passing Values from a Web Form to Another Web Form
Hello All! I am trying to pass values from one web form to another web form. I know that there are 3 ways of doing this: queryString, Server.Transfer and Session. I am using the Server.Transfer method. But I am not able to create, in my 2nd web form, an instance of my 1st web form. My 1st Web form is named CallTrack.aspx and my 2nd is named Export.aspx. What I mean is something like this: Public value as CallTrack. I can't create it in my 2nd web form because when the intellisense is displayed, there's no CallTrack in the options. Thanks!   How about using cross-...

How to get the HREF value of the Anchor tag in a web page using the web browser control in vb.net
Hi Friends,               i have a webserver control in my application.i load the web browser control on a button click using the below code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click                AxWebBrowser1.Navigate("http://www.rateitall.com/i-322335-.aspx", False) End sub once the page is loaded in the browser i want the <a> HREF value in that page.For example if that page has ...

Get listbox value from the other web form
 Dear all, I want to get the lisbox selecteditem value to a textbox in one web form from the other web page. Should I use session to get this value?Can any one help in this regard? Thanks a lot in advance.  People Develop People Yes you can use Session to get the informations between cross pages.. see below for your referenceTO STORE THE INFO in Session Session["key"] = ListBox1.SelectedItem.Value; Response.Redirect("Page2.aspx");TO GET THE VALUES FROM Sessionprotected void Page_Load(object sender, EventArgs e){    if (Sessio...

If Not value or value then....
Hi all,I want to write a simple IF Not then statement in ASP.net 2.0 and I would like some help please.  If Not ntuser = "DOMAIN\ntuser" Or ntuser = "DOMAIN\ntuser2" Then Panel1.Visible = False End If Doesnt work, can you tell me where i'm going wrong please?many thanks.  The first place you're going wrong is in telling us it "doesn't work" without providing any details. JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue. Use Not as stated below. It ...

can I get value from Web.config and use the value as a parameter?
in my orginal program code        internal static void QueryForExportAgent(ref StringBuilder sb,decimal MasterKey)     {      sb.Append("SELECT * FROM ZT_Detail WHERE ");      sb.Append(fMasterKey);      sb.Append("=");      sb.Append(setParametersValidation(MasterKey));      sb.Append(" AND ");      sb.Append(fTYPE);  ...

Comparing Values of a textbox seperated by commas to an arraylist
Hi All, I am trying to compare the values of the hiddenValue.TEXT which are seperated by comma's to the values of the array list. So if the values that are in the hiddenValue text is not in the selected arraylist then it does an update to the db else it does a new insert from the arraylist.. Can anyone help me by showing me how to modify this? Thank so much Response.Write("Begining Value" + hiddenValue.Text.ToString() + "<br>");//gives me the values from the db on page load ArrayList multipleAirport = GetSelectedItems (airportlist);foreach (string ap in ...

How to get Textbox value in web user control?
Hi friends,I created a web user control with only one textbox.(textbox.ascx) and textbox id=" txtSimple"textbox user control having some property. another user control with button(button.ascx) next i use two textbox usercontrol and one button usercontrol in sample.aspx. when i click button at that time call the required field validate property in textbox user control.in property have following code.public bool RequireValidate    {        set        {     &nbs...

passing values to .net web form application
Hi Can any explain me abt how to pass values to my .NET web form application (designed using PB 11.1) from other web application? My intension is to redirect from a web application (ASP.NET to .net web form application) to my web application with user information. Thanks & Regards, Anbazhagan From the "Deploying Applications and Components to .NET" manual: >>> Starting an application with command line parameters If your application requires command line parameters, you can assign values to the PBCommandParm global property before you deploy the...

form getting old textbox.text values
I've got a form that when loaded loads it's values from the database and then allows you to edit them (using textbox controls). When you click save it adds what I would think should be the newly edited values into the parameters and updates the database. However it is instead loading the values prior to them being changed rather than the current values in the text boxes. Anybody know what would cause this?Could be WAAAY off in any suggestions I give in posts, so be on the lookout for stupidity :P As you have  not included any code samples, I can only suggest a possibility.Check...

get value from <select> value & display value
hi all, i want these two bold values which are below,  underline value i can get but second bold value i m not avail to get please help.... <select><option value="ma">manoj</option> </select> regard khushak  P.S. if possible then Please with  java script other wise code behind New In .NET World See my post in this thread.  That should take care of you. Peter BrunoneMS MVP, ASP.NETFounder, EasyListBox.comDo the impossible, and go home early....

Web resources about - Get values of textbox with values seperated by comma - asp.net.web-forms

Children seperated from their families by courts must know why
Britain's most senior family judge says children who are seperated from their families must be able to access a record of what the judge ruled ...

D-Wade Gets Frustrated With Coach - YouTube
Dwyane Wade had to be seperated from coach Erik Spoelstra during a timeout vs. Pacers.

Template talk:UTC time offsets - Wikipedia, the free encyclopedia
This template is within the scope of WikiProject Time , a collaborative effort to improve the coverage of Time on Wikipedia. If you would like ...

2012 Volkswagen Amarok
Volkswagen's reloaded Amarok

Investments - Life Insurance Canada
Think of your child and yourself. Save for your child's education or invest for your retirement with Registered Education or Retirement Savings ...

Netmon Add-ons - Netmon.ca
Monitor all your infrastructure from a single, integrated console. Monitor environmental conditions in large areas or physically seperated spaces. ...

Lesley Arfin of HBO's Girls Takes Us Inside Her Cl Video – 5min.com
Lesley Arfin, writer of HBO series girls, discusses her personal style and more

Asian Cinema Drifter - Asian Movie Review List
Asian Cinema Drifter [ACDrifter.com] is a compilation of Asian movie reviews. ACD contains an extensive media gallery, actor and actress information, ...

Science Hobbyistcomment Book: Miscon
I just came across your site. Great stuff. I think even many adultswith only a kind of amateur interest in physics would do well to read yourmaterial ...

GOP fails in attempt to stop counting ballots in Washington
In a very close election, seperated by only 261 votes , the GOP filed to stop hand counting. The argument was related to the issues of recounting ...

Resources last updated: 12/25/2015 12:39:17 PM