?
Solved

Question on Textbox Value, which is more economical

Posted on 2010-01-12
15
Medium Priority
?
400 Views
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.

Thanks
0
Comment
Question by:aspnewbie09
  • 8
  • 6
15 Comments
 
LVL 13

Expert Comment

by:zadeveloper
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.
0
 
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
0
 

Author Comment

by:aspnewbie09
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.
0
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.

 
LVL 18

Expert Comment

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

Author Comment

by:aspnewbie09
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?

thanks
0
 
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 ??


0
 

Author Comment

by:aspnewbie09
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?
0
 
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) & ",")
        Next
0
 

Author Comment

by:aspnewbie09
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

Next
0
 
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 :)





Split-functionality-with-session.txt
0
 

Author Comment

by:aspnewbie09
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?

Thanks
0
 

Author Comment

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

Author Comment

by:aspnewbie09
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 :)
0
 
LVL 18

Accepted Solution

by:
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) & ","
        Next
        StyleColorSize1.Text = Left(mainstring, Len(mainstring) - 1) ' This will remove the final cama
    End Sub

Open in new window

0
 

Author Closing Comment

by:aspnewbie09
ID: 31676155
superb instructions and quick response!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

571 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