Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TextMode=Number is not working

Tags:

c#

asp.net

I am Using a Textbox in my Web application in asp. I want to enter the quantity of the product to appear as enter image description here

my aspx code is

 <asp:TextBox ID="TextBox4"  Width="55px" Height="39px" TextMode="Number" runat="server" min="1" max='<%# Eval("Quantity") %>' step="1"></asp:TextBox>  

and cs page code is

int quantity = Convert.ToInt16(TextBox4.Text);

where is wish to access the selected quantity of my TextBox4. But is shows the error that The input string is not in the correct format

Am i not using the correct input format?

like image 985
Iqra Avatar asked Dec 18 '25 05:12

Iqra


1 Answers

Set the initial text like this

<asp:TextBox id="textbox4" Width="55px" Height="39px" TextMode="Number" runat="server" min="1" max='<%# Eval("Quantity") %>' step="1" Text="0"></asp:TextBox>

this will solve ur problem

like image 93
Nouman Bhatti Avatar answered Dec 20 '25 22:12

Nouman Bhatti



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!