c# .net

How to convert string to integer in c# asp.net?

How to convert string to integer in c# asp.net? , someone asked me to explain?

In this article I will explain how to convert string to integer an example. This is needed when I want to delete the number of user susing userId. I got collection of string result from List<string>iList. I need to convert string to integer below example describes about it.

 [HttpPost]
        public ActionResult DeleteUserLogin(List<string>iList)

        {
            string message = "";

            UserLogin UserLogin = new UserLogin();

             if (iList == null)

            {
              message = "No Record(s) selected.";
                goto out1;
            }

            int i = 0;
 
            foreach (string row_loopVariable in iList)

            {
               int UserLoginId = Convert.ToInt16(row_loopVariable);

                i = i + 1;

                if (UserLoginId > 0)

                {
                    UserLogin.DeleteUserLogin((string)HttpContext.Session["DBConnector"], UserLoginId);
                   message = "Record(s) Deletedsucessfully.";
                }
            }
 
        out1:

            if (Request.IsAjaxRequest())

            {
                              return Json(message, JsonRequestBehavior.AllowGet);
            }

            else

            {
                return RedirectToAction("ListUserLogin", "UserLogin", new { area = "Admin" });
            }

        }

 

Post your comments / questions