Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi everyone...

i want to create a field in which,need to enter my mobile number where my 10 digites should be placed as each digit in one column in that field i.e... aspx page.

i know a html control like <input type="number">
but this should be in aspx page means asp.net input element..

so my question is how should i write code to make my text field with 10 columns where user will enter mobile number during run time on a web page and it should be placed one digit in one column...

will u anyone help me the code either aspx page r aspx.cs ?????????
Posted
Updated 26-Feb-15 9:45am
v3
Comments
Suvendu Shekhar Giri 26-Feb-15 13:53pm    
1)10 textboxes of fixed width. 2) Javascript numeric validation. 3) javascript code to shift cursor to next textbox once value is entered in a textbox. These can be some rough ideas
Maciej Los 26-Feb-15 15:58pm    
There is no reason to split mobile number into 10 digits. Please, tell us what you want to do.
NagaNimesh 11474558 27-Feb-15 4:33am    
Thanx for your support Maciej Los..
my question is i have a UI having a field where should i enter mobile number in such a that field like a one text box having 10 columns in which the 10 digits number will enter in to that field like each digit in each box.. i hope u might understand now...
ZurdoDev 26-Feb-15 16:59pm    
Isn't it obvious? You want 10 textboxes. I think it is a bad UI choice, but what is so hard about doing what you want?
Santosh K. Tripathi 26-Feb-15 23:19pm    
Peter Leow's answer is good.

What you need is one text box with input validation for mobile number, e.g.:
XML
<asp:TextBox ID="txtMobileNo" runat="server" />
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
      ControlToValidate="txtMobileNo" ErrorMessage="Please enter a 10-digit mobile number" ValidationExpression="\d{10}" />

Read more: RegularExpressionValidator[^]
 
Share this answer
 
Comments
NagaNimesh 11474558 27-Feb-15 4:03am    
tanq for your suggestion MR.Peter Leow i accept your code but have a doubt..
based on your suggestion i will enter a mobile number on my web page but my UI having a with 10 columns in such a way my 10 digit mobile number will split and each column will read each digit ....

i want c# code will u plz tell me...
Maciej Los 27-Feb-15 4:36am    
Change your UI ;)
NagaNimesh 11474558 27-Feb-15 5:04am    
ha ha very funny.... Maciej Los
i got a task like that....
Peter Leow 27-Feb-15 5:39am    
Ok, since you insist. You know the input type="number" of HTML5, you can use it in aspx like this:
<asp:TextBox ID="txtDigit1" runat="server" type="number" min="0" max="9">
so you will have 10 of these text boxes side-by-side for the user to enter his mobile number. Usability?
Having said that, I will still go with Maciej's suggestion.
NagaNimesh 11474558 1-Mar-15 23:55pm    
tanq so much to you both your best suggestion.. mr.peter Leow , Maciej Los
Assuming that you want to put 10 inputs in a row...

You can place 10 inputs in a table[^] in single row[^] with 10 columns[^].
 
Share this answer
 

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