Click here to Skip to main content
15,894,343 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
but i need on insertion of ascii value on one text box get a to z then sequentially in drop down list
Posted
Updated 15-Apr-14 23:57pm
v2
Comments
Richard MacCutchan 16-Apr-14 5:57am    
Posting exactly the same text as content and question does not make your problem clear. Please edit your question and explain exactly what your problem is.
OriginalGriff 16-Apr-14 5:57am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.
Rahul VB 16-Apr-14 6:38am    
Now listen to me:
You want to enter the characters from A-Z in the text box and then to the Drop Down list via the text box?

1 solution

Trying to clarify your question:

1. You have a text box that will accept only the letters A through Z (not impossible, requires client-side or server-side validation to filter out unwanted characters]. Once the letters are entered, they are used to populate a drop-down list [easy, either through a client side script or a post to the server and return of the populated drop down list]

-or-

2. You want a text box to contain "ABCDEFGHIJKLMNOPQRSTUVWXYZ" and a dropdown list with 26 options of "A" through "Z". [much easier]


1. For a user-populated drop down following input from the user to the server:
ASP.NET
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="textlist.aspx.vb" Inherits="textlist" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <input type="text" name="letters" id="letters" runat="server" /> <select name="myselect" id="myselect" runat="server"></select><br />
    <input type="submit" value="GO" />
    </div>
    </form>
</body>
</html>


VB
Imports System.Text.RegularExpressions

Partial Class textlist
    Inherits System.Web.UI.Page


    Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
        Dim letters As String = Page.Request.Params("letters")
        myselect.Items.Clear()


        If Not letters Is Nothing Then

            Dim upper As New RegularExpressions.Regex("^([A-Z]{1,})$") ' Any concern about checking for duplicates?
            If Not upper.Match(letters).Length = 0 Then ' only uppercase letters are accepted.

                Dim chars As Char() = letters.ToCharArray

                For Each a As String In chars
                    myselect.Items.Add(a)
                Next
            End If
        End If
    End Sub
End Class


...
for client-side population of the drop-down before sending to the server, you can use JavaScript to parse the text box value and populate the select options.

2. For a pre-defined drop down:
- eliminate the parameter check (runs even without user input)
- assign the chars variable the desired values:
- assign the value of the text box the desired string.
VB
chars="ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray 

...
HTML
<input type="text" name="letters" id="letters" value="ABCDEFGHIJKLMNOPQRSTUVWXYZ" />
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900