HI Everyone, I have a little problem...........
I have a textbox, I want to store 12 max digit in this TxtBox as 11.23456.789 formate. Means at 3 position will take as . and 8position is also take .
I m using this code if (Spartno1.Text.Length!=0) { if ((Spartno1.Text.Substring(2,1)!=".") && (Spartno1.Text.Substring(8,1)!=".") && (Spartno1.Text.Length==12) ) { Page.RegisterStartupScript("Message","<script language='javascript'>alert('Please Enter The Valid Part No! ');</script>"); return; } } else Spartno1.Text="";
but Problem is this if im inter as 12.334567890 then it not check at 8 position for . Pls help me
|
| Author: Pradeep Kumar Chaudhary 30 Aug 2008 | Member Level: Gold | Rating: Points: 4 |
The logic cannot meet to your position, what you want. Use for loop to do this work.The loop can not work properly the third condition (Spartno1.Text.Length==12) ) can't check whether the loop move. So your logic is perfect but the loop cannot reach their top position.
|
| Author: Gaurav Agrawal 31 Aug 2008 | Member Level: Gold | Rating: Points: 3 |
use it regular expression validation for this and use Regular Expression Library Site http://www.regexlib.com for proper expression as u want
GA
|