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
Recent Article
- Requested setting INSTALLED_APPS, but settings are not configured. You must either define..
- ValueError:All arrays must be of the same length - Python
- Check hostname requires server hostname - SOLVED
- How to restrict access to the page Access only for logged user in Django
- Migration admin.0001_initial is applied before its dependency admin.0001_initial on database default
- Add or change a related_name argument to the definition for 'auth.User.groups' or 'DriverUser.groups'. -Django ERROR
- Addition of two numbers in django python
- The request was aborted: Could not create SSL/TLS secure channel -Error in Asp.net
Related Article