Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
in my web form one textbox,button and gridview

if we enter mobilenum in textbox and click the button it will show all details in gridview

my problem is
if enter the number something like 1234567893 it will show
but if enter 01234567893 also it show how to write code for that

simply Any phone number with or without “0” should be considered as one number

when ever click on search button
if num starts with zero remove zero and search with else nums

remove means
we have to search with out zero how to write the code in aspx.cs


thankx
Posted
Updated 29-Mar-15 19:05pm
v3

In your code you have to manage the input number by removing the starting zero from the beginning of the number like in the code below:
C#
string userInput= textBoxNumber.Text;
if(userInput.StartWith("0"))
{
  userInput= userInput.Substring(1);
}
//
// Use the user input in your search
//....
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 30-Mar-15 20:59pm    
5ed.

By the way, I invite your to see my new 1 of April publication and have some fun:
Some Programming Approaches to "Neuro-Linguistic Programming".
Participation in this game in Comments and Discussions is especially encouraged.

Thank you.
—SA
Raul Iloc 31-Mar-15 7:35am    
Thank you for your vote!
I will look on your publication.
To keep the starting zeros you need to treat the input/output as a string. if you change to a number the zeros will be removed.
 
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