ValidationHelper error

javier saenz asked on September 13, 2016 22:33

Hello
I am working a webpart where I need to get an order id from the url, as Kentico say I'm using this code:
string orderHash = QueryHelper.GetString("o", string.Empty);
orderId = ValidationHelper.GetInteger(WindowHelper.GetItem(orderHash), 0);
But when I try to use that orderId I'm getting this error:

Message: Input string was not in a correct format.
Exception type: System.FormatException Stack Trace: at System.Number.ParseDouble(String value, NumberStyles options, NumberFormatInfo numfmt) at System.String.System.IConvertible.ToDouble(IFormatProvider provider) at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider) at CMS.Ecommerce.SKUInfoSerializer.Convert(XmlData data, String columnName, Type type) at CMS.Ecommerce.InfoSerializer`1.Deserialize(XmlData xmlData) at CMS.Ecommerce.OrderItemInfo.get_OrderItemSKU()

Any idea what could be the error? (I am on kentico9)

Recent Answers


Joshua Adams answered on September 13, 2016 22:52

That is what Kentico controls use...but are you sending the item to the url correctly?

Here is an example of a link created to allow someone to finish their order at a later date:

Setting URL:

 string orderHash = ShoppingCart.GetHashCode().ToString();
                            WindowHelper.Add(orderHash, oi.OrderID);
                            return "<a href=\"" + paymentPageURL + "?o=" + orderHash + "\">Make Payment</a>";

Retrieving order id:

 string orderHash = QueryHelper.GetString("o", string.Empty);
        orderId = ValidationHelper.GetInteger(WindowHelper.GetItem(orderHash), 0);

Sounds like you aren't adding the hash to the window correctly or something along those lines.

0 votesVote for this answer Mark as a Correct answer

javier saenz answered on September 13, 2016 23:17

Actually if I print that orderHash I get what it should be, I mean the url slide that I need, the problem seems to be in the WindowHelper.GetItem(orderHash) code

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.