I'm using ASP.net and setting the value of a textbox with Javascript. When I go to save the contents of the page I am unable to get the value of the textbox, it just comes back as nothing.
I have tried setting the value using value, innertext and innerhtml and unable to get the value from any of them. Setting using JS:
document.getElementById('<%= txtNettWeight.ClientID %>').innerText = NettWeight;
On Save:
if (!string.IsNullOrEmpty(txtNettWeight.Text))
{ sqlComm.Parameters.AddWithValue("@NetWeight", Convert.ToDecimal(txtNettWeight.Text));
}
try using single qoutes
This works for me,
Html Markup:
Client-side:
Code behind: