How to resolve “Input string was not in a correct format.” error?

What I tried: MarkUP: <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:Label ID="Label1" runat="server" AssociatedControlID="TextBox2" Text="Label"></asp:Label> <asp:SliderExtender ID="SliderExtender1" TargetControlID="TextBox2" BoundControlID="Label1" Maximum="200" Minimum="100" runat="server"> </asp:SliderExtender> Code Behind: protected void setImageWidth() { int imageWidth; if (Label1.Text != null) { imageWidth = 1 * Convert.ToInt32(Label1.Text); Image1.Width = imageWidth; } } After running the page on a browser, I get the System.FormatException: Input … Read more