getting textbox text from client back to server side
-
Hi. I am trying to retrieve the text of a textbox from code behind after setting the text via javascript (JS) on the page itself. I do it like this via JS on a html radiobutton event:
var provider = document.getElementById('<%=txtMailProvider.ID %>');
provider.value = '@blah.com';I then try to get that text from the txtbox on a server button click event, in code like:
string blah = txtMailProvider.Text;
this bring back and empty string. Is there another, working, way to do this? Tried google, etc Any help would be great. Thanks M
-
Hi. I am trying to retrieve the text of a textbox from code behind after setting the text via javascript (JS) on the page itself. I do it like this via JS on a html radiobutton event:
var provider = document.getElementById('<%=txtMailProvider.ID %>');
provider.value = '@blah.com';I then try to get that text from the txtbox on a server button click event, in code like:
string blah = txtMailProvider.Text;
this bring back and empty string. Is there another, working, way to do this? Tried google, etc Any help would be great. Thanks M
-
Hi. I am trying to retrieve the text of a textbox from code behind after setting the text via javascript (JS) on the page itself. I do it like this via JS on a html radiobutton event:
var provider = document.getElementById('<%=txtMailProvider.ID %>');
provider.value = '@blah.com';I then try to get that text from the txtbox on a server button click event, in code like:
string blah = txtMailProvider.Text;
this bring back and empty string. Is there another, working, way to do this? Tried google, etc Any help would be great. Thanks M
Firstly, check that EnableViewState hasn't been set to false on your text box. It's true by default so it will only be false if you or another programmer has added: EnableViewState="false"
Mark Graham (MCP) // The Doodler blogging at: dotnet notepad
-
Firstly, check that EnableViewState hasn't been set to false on your text box. It's true by default so it will only be false if you or another programmer has added: EnableViewState="false"
Mark Graham (MCP) // The Doodler blogging at: dotnet notepad