Hey there,
It could be one of these lines:
int w = Convert.ToInt32(W.Value);
int h = Convert.ToInt32(H.Value);
int x = Convert.ToInt32(X.Value);
int y = Convert.ToInt32(Y.Value);
This Exception could occur if any of the hidden fields in these statement have
empty
value and since you have not set a default
Int
value in these lines:
<asp:hiddenfield id="X" runat="server"/>
<asp:hiddenfield id="Y" runat="server" />
<asp:hiddenfield id="W" runat="server" />
<asp:hiddenfield id="H" runat="server"/>
I susspect that this is causing the Exception.
Anyway, either set a default value like e.g,
<asp:hiddenfield id="Y" runat="server" value="0" />
or check the Hidden Fields value is not
Empty String
before Converting them, e.g,
int h = H.Value != string.empty ? Convert.ToInt32(H.Value) : 0;
Hope it helps
Azee...