How to convert a string into an Integer in ASP.net?
Answers were Sorted based on User's Feedback
Answer / guest
by two ways u can do that
1.
int a = Int.Parse("String");
2.
int a = Convert.Int32("String");
| Is This Answer Correct ? | 100 Yes | 18 No |
Answer / bhaskar
int A = CInt("String") i think this is the best way
| Is This Answer Correct ? | 24 Yes | 7 No |
Answer / sai krishna
If you don't pass integer value, it gives the
exception "Input string was not in a correct format."
| Is This Answer Correct ? | 14 Yes | 1 No |
Answer / sai krishna
int a = Convert.ToInt32("2");
int b = Int32.Parse("3");
Response.Write( a.ToString() + " " + b.ToString());
| Is This Answer Correct ? | 11 Yes | 1 No |
Answer / sanjay
1))int a=int.Parse("string");
2))int a=Convert.ToInt32("string");
3))int a=(int)"string";
but the string provided should be integer
| Is This Answer Correct ? | 9 Yes | 2 No |
int.Parse parses the input (casts in a sense) to an integer
value however it will throw an exception if it cant do it if
the data provided is not numeric. you should use TryParse in
.NET 2.0 to see if it can parse it.
int a = Int.Parse("int");
Convert.ToInt32() converts the string data to a proper true
int32 value, and throws an exception if it can't convert the
value.
int a = Convert.Int32("String");
| Is This Answer Correct ? | 5 Yes | 4 No |
Answer / binu
All the above are correct. but if you want the integer value of a string( like 'binu') you have to find its ascii value..
There is no other option
| Is This Answer Correct ? | 1 Yes | 0 No |
How will you do windows authentication and what is the namespace? If a user is logged under integrated windows authentication mode, but he is still not able to logon, what might be the possible cause for this? In ASP.Net application how do you find the name of the logged in person under windows authentication?
how can u create the forms authentication?and what is the difference between forms authentication and windows authentication?
What is viewstate?
What is the used of "ispostback" property?
If I'm developing an application that must accommodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing) what would be the best approach to maintain login-in state for the users?
What is dataset ?
18 Answers Infosys, Kuwait University,
Describe the difference between inline and code behind - which is best in a loosely coupled solution Tightly coupled - INLINE
What is cookies in asp net?
How to retrieve the information from datatable citywise in c#?
What are the disadvantages of viewstate/what are the benefits
Which two properties are there on every validation control?
How many types of session in ASP.NET
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)