c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
c# .net

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

| | ASP-NET , CSharp

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" });
            }

        }