N K N K - 6 months ago 9
HTML Question

Not getting Input text value in code behind

I want to use the value of the

textbox
which is input
html
in one of my query. SO I tried like below

string strInwardNO = Request.Form["TxtIwNo"];


and HTML is

<input id="TxtIwNo" type="text" runat="server" disabled="disabled" />


but I am not getting value. What is wrong here

When I check while debugging, I always get it as NULL

Answer

In order to input field value was posted to your backend it cannot be disabled. Change it to readonly and style it to look like disabled:

input[readonly] { 
    background: #CCC; 
    color: #333; 
    border: 1px solid #666 
}