to get vale in javascript to c#
-
hi all i have some values on html page in javascript. i want to get that values in C#. how to do that. I tried displaying it on a label, and retreave it from there. This is the function in javascript
function display() { var localpath1 = document.getElementById('lblerr'); lblerr.innerText = localpath; }
it is diplaying the value on label. lblerr is the id of label. am calling this function on pageload but when i try to get the value using lblerr.text, it is showing null. y is it so? how to get value on the label -
hi all i have some values on html page in javascript. i want to get that values in C#. how to do that. I tried displaying it on a label, and retreave it from there. This is the function in javascript
function display() { var localpath1 = document.getElementById('lblerr'); lblerr.innerText = localpath; }
it is diplaying the value on label. lblerr is the id of label. am calling this function on pageload but when i try to get the value using lblerr.text, it is showing null. y is it so? how to get value on the labelinnerText is a different property its not same as .Text. Make a hidden variable in a form with runat="server" and assign it that value. In .aspx
In javascript u can write document.getElementById('hdnVar').value = localpath; and in c# lblerr.Text = hdVar.value.ToString(); Try it, It should work. Prateek... Prateek..
-
innerText is a different property its not same as .Text. Make a hidden variable in a form with runat="server" and assign it that value. In .aspx
In javascript u can write document.getElementById('hdnVar').value = localpath; and in c# lblerr.Text = hdVar.value.ToString(); Try it, It should work. Prateek... Prateek..
-
hi all i have some values on html page in javascript. i want to get that values in C#. how to do that. I tried displaying it on a label, and retreave it from there. This is the function in javascript
function display() { var localpath1 = document.getElementById('lblerr'); lblerr.innerText = localpath; }
it is diplaying the value on label. lblerr is the id of label. am calling this function on pageload but when i try to get the value using lblerr.text, it is showing null. y is it so? how to get value on the labelP_Elza wrote:
m calling this function on pageload but when i try to get the value using lblerr.text, it is showing null.
Try using this:
if (this.IsPostback)
{
string value = Request["lblerr"];
}Hope it helps. PS: Don't open new topics....continue on the one already opened and try explain more detailed.
Another hint: This is the C# forum...there is an ASP.NET forum also.There are 10 kinds of people: those who understand binary and those who don't