Решение:

// Get the quantity, guarding against bogus values

if (Int32.TryParse(quantityTextBox.Text, out quantity))
{
// Update product quantity
success = success && ShoppingCartAccess.UpdateItem(productId, quantity);
}
else
{
// if TryParse didn't succeed
success = false;
}

 

Опубликовано в ASP.NET