Possible Duplicate:
How can I convert String to Int?
how can i change queryString value to an (int)
string str_id;
str_id = Request.QueryString["id"];
int id = (int)str_id;
Use Int32.TryParse Method to get int
value safely:
int id;
string str_id = Request.QueryString["id"];
if(int.TryParse(str_id,out id))
{
//id now contains your int value
}
else
{
//str_id contained something else, i.e. not int
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With