海友我对Asp.Net有疑问 [英] Hai Friends I Have A Question On Asp.Net

查看:77
本文介绍了海友我对Asp.Net有疑问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网页表单中,一个文本框,按钮和gridview



如果我们在文本框中输入mobilenum并单击按钮,它将在gridview中显示所有详细信息



我的问题是

如果输入类似1234567893的数字它会显示

但如果输入01234567893它也显示如何为此编写代码



简单任何带或不带0的电话号码都应视为一个号码



当点击搜索按钮时

如果num从零开始删除零并搜索其他nums



删除意味着

我们必须搜索零如何在aspx.cs中编写代码





thankx

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

推荐答案

在您的代码中,您必须通过从数字开头删除起始零来管理输入数字,如下面的代码所示:

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:
string userInput= textBoxNumber.Text;
if(userInput.StartWith("0"))
{
  userInput= userInput.Substring(1);
}
//
// Use the user input in your search
//....


要保持起始零,您需要将输入/输出视为一个字符串。如果您更改为数字,则将删除零。
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.


这篇关于海友我对Asp.Net有疑问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆