Question on Textbox Value, which is more economical

Posted on 2010-01-12
Medium Priority
Last Modified: 2012-05-08
I have a question.  Is it more economical to have a large textbox to allow customer to type in what they want and separate each items by a semicolon or to have three separate textboxes?

the textbox is to store style#, color and size.  It does not get saved into a database; just display on a page after the information is being entered.

Question by:aspnewbie09
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
  • 8
  • 6
LVL 13

Expert Comment

ID: 26294680
It is better to have 3 textboxes. But technically more economical to have 1, but the text box data sent to the client browser to create the text box is so small it's not worth it to save bandwidth by reducing the number of textboxes from 1 to 3 . Really it will save you maybe 100 bytes. It's better design to ramble a better use experience.
LVL 18

Expert Comment

by:Rajar Ahmed
ID: 26295124
Hi mate ,

If u have single text box u will need many unncess validation which will definetely bug u , and also it kills user interface ..

If u r doing it in ADmin panel , then u can go through with single textbox and Giving a message  seperate by it # , But for user interface dont go with single textbox basically a user doesnt like to do all such things ..

Better Go with three textbox .

Meeran 03

Author Comment

ID: 26295713
thanks (to meeran03 & zadeveloper) to both of you.  

now another question, is it possible to extract info from textbox1, textbox2, and textbox3 using a semicolon as separate then append (textbox1 info with textbox2 info with textbox3 info?) when display to the customer?

Lots of thanks.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

LVL 18

Expert Comment

by:Rajar Ahmed
ID: 26295771
Response.write(textbox1.text & ";" & textbox2.text & ";" & textbox3.text)

Author Comment

ID: 26296014
well, that's the second part.  each of the textbox customer can enter the same number of style, color and size respectively as follow:

in textbox1, a customer can enter more than 1 style number follow by a semicolon (eg. 500; 503; 505)
in textbox2, a customer can the same number of color for style (black; white; pink)
in textbox3, customer can enter sizes (6-8; 9-11; 10-12)

is it possible to extract all character and stop at the semicolon, then extract textbox2 until reach semicolon then textbo3 until semicolon

then will concatenate to display it in the result page?

LVL 18

Expert Comment

by:Rajar Ahmed
ID: 26296126
do u want , such a way that ..??

If user enter in first text box two semicolumn
then other two also have two semicolumn like that uh ??

i dint get u properly ..

Can u make it clear ??


Author Comment

ID: 26296420
from my example above, is it possible to extract:

style 501 from textbox1
color black from textbox2
size 6-8 from textbox3

so that on the display (result) page, it can display as: 501 black 6-8; 503 white 9-11, 505 pink 10-12?
LVL 18

Expert Comment

by:Rajar Ahmed
ID: 26299723
Try this.....    
       Dim string1() = textbox1.Text.Split(";")
        Dim string2() = textbox2.Text.Split(";")
        Dim string3() = textbox3.Text.Split(";")

        For i As Integer = 0 To 2
            Response.Write(string1(i) & " " & string2(i) & " " & string3(i) & ",")

Author Comment

ID: 26304250
here's my page 1 aspx code:

<asp:CheckBox ID="CheckBox1" runat="server"  Text="Sun Flower"  />
Style #:<asp:TextBox ID="txtStyleNo1" runat="server"  Width="800px"></asp:TextBox>
Color: <asp:TextBox ID="txtColor1" runat="server" Width="800px"></asp:TextBox>
Size:&nbsp;&nbsp;<asp:TextBox ID="txtSize1" runat="server" Width="800px"></asp:TextBox>

page 1 aspx.vb code: (store in session since i am transfering it to another page)
 *string1, string2, string3 declare in global.asa

Session("string1()") = txtStyleNo1.Text.Split(";")
Session("string2()") = txtColor1.Text.Split(";")
Session("string3()") = txtSize1.Text.Split(";")

page 2 aspx code:
<asp:Label ID="ShirtType" runat="server" ></asp:Label>
<asp:Label ID="StyleColorSize1" runat="server"></asp:Label>

page 2 aspx.vb code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'get value of test checked
        If Session("values") IsNot Nothing Then
            Dim h_obj As Hashtable = TryCast(Session("values"), Hashtable)
            For Each strkey As String In h_obj.Keys

                'need to strip out the "CheckBox" from "CheckBox1" to get the real target ID
                Dim targetID As String = strkey.Replace("CheckBox", "")
                Dim lb As New Label()

                lb.ID = "Label" & targetID 'strkey.ToCharArray().Reverse().First().ToString()
                lb.ID = "Label" & strkey.ToCharArray().Reverse().Last().ToString()
                lb.Text = h_obj(strkey).ToString()

tempLabel2 = TryCast(FindControl("ShirtTypeResult" + targetID), Label)
                If (Not tempLabel2 Is Nothing) Then tempLabel2.Text = Session("fiTestMethod" + targetID).ToString() & "<br>" '& "<br>"

For i As Integer = 0 To 2
     'Response.Write(string1(i) & " " & string2(i) & " " & string3(i) & ",")
      lbStyleNo = TryCast(FindControl("StyleColorSize" + targetID), Label)
      If (Not lbStyleNo Is Nothing) Then lbStyleNo.Text = Session("string1(i)").ToString() & Session("string2(i)").ToString() & Session("string3(i)").ToString() -- got this error msg: Object reference nto set to an instance of an object

LVL 18

Expert Comment

by:Rajar Ahmed
ID: 26305805
Hi aspnewbie09,

    I had shown u a working process which u asked in the question .....Check it out...

Good Luck : )

Meeran 03 :)


Author Comment

ID: 26307567
thanks.  click on this url: http://www.hosetech.com/error-msg.jpg
to see new error msg.  when i did a mouseover the variable does have values as you can see it here: http://www.hosetech.com/string-variable-value.jpg

so what does the error msg mean?


Author Comment

ID: 26307581
Never mind; i didn't enter enough values for the array.

Author Comment

ID: 26307660
How can I solve the error above?  

a customer does not have to specify 3 different style#, nor color nor size.  the customer can just enter 1 style, 1 color and 1 size.

Is there a way to loop through the textbox and count how many items have been entered for each textbox then instead of 0 to 2; it will be, 0 to HowManyFound?

Thanks :)
LVL 18

Accepted Solution

Rajar Ahmed earned 1000 total points
ID: 26310791
Check this..
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim string1() = Session("string1").Split(";")
        Dim string2() = Session("string2").Split(";")
        Dim string3() = Session("string3").Split(";")
        Dim mainstring
        For i As Integer = 0 To UBound(string1)
            mainstring = mainstring & " " & string1(i) & " " & string2(i) & " " & string3(i) & ","
        StyleColorSize1.Text = Left(mainstring, Len(mainstring) - 1) ' This will remove the final cama
    End Sub

Open in new window


Author Closing Comment

ID: 31676155
superb instructions and quick response!

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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.…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

762 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