How to pass values from javascript to server-side
-
How to pass values from javascript to server-side
-
How to pass values from javascript to server-side
Using a hidden input field.
Navaneeth How to use google | Ask smart questions
-
Using a hidden input field.
Navaneeth How to use google | Ask smart questions
can u give an example
-
can u give an example
1 - put a server hidden field in your page 2 - write the name of the field as a variable through to javascript, so you have the client side Id 3 - use document.getElementById to find the Id, and then set the value in JS 4 - on postback, read it from the hidden field.
Christian Graus Driven to the arms of OSX by Vista.
-
can u give an example
<input type="hidden" name="txtHidden" id="txtHidden" runat="server">
document.getElementById("txtHidden").value = "Set your value here"You can use
txtHidden.Text
on server side to get the value. :)Navaneeth How to use google | Ask smart questions
-
<input type="hidden" name="txtHidden" id="txtHidden" runat="server">
document.getElementById("txtHidden").value = "Set your value here"You can use
txtHidden.Text
on server side to get the value. :)Navaneeth How to use google | Ask smart questions
runat=server won't change the id ? I see it's not a server control, but still, I did not know that.
Christian Graus Driven to the arms of OSX by Vista.
-
runat=server won't change the id ? I see it's not a server control, but still, I did not know that.
Christian Graus Driven to the arms of OSX by Vista.
Christian Graus wrote:
runat=server won't change the id
It will, only if the control is in a container(like panel etc). In such cases, it prefixes the container id with the control id to make the name unique. In normal cases, it won't.
Navaneeth How to use google | Ask smart questions