Get value of input type number in c#

2.6k Views Asked by At

example:

<input id="txtEntQty" type="number" min="1" max='<%# Eval("RemQty")%>' value='<%# Eval("RemQty")%>'>

code behind:

int ASSIGNQTY = Convert.ToInt32((row.Cells[12].FindControl("txtQty") as **?????**).value);
1

There are 1 best solutions below

2
On BEST ANSWER

Try this make your input runat="server"

<input type="number" id="txNUm" runat="server" />

And in .cs code where you want to get value write thiss

System.Web.UI.HtmlControls.HtmlInputControl input = (System.Web.UI.HtmlControls.HtmlInputControl)gvrow.Cells[5].FindControl("txNUm");
int ASSIGNQTY = Convert.ToInt32(input.Value);