Hi Experts..
I want to assign a value stored in a javascript variable to an asp:textbox control.
I tried this but its not working.
The value property is not coming.Please help me out..
document.getElementById('<%=txtEmail%>').value
Hi Experts..
I want to assign a value stored in a javascript variable to an asp:textbox control.
I tried this but its not working.
The value property is not coming.Please help me out..
document.getElementById('<%=txtEmail%>').value
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Pankaj RanaRank #2,270 · 620 reputationPosted Dec 10, 2011, 12:07 AM EST
Try this document.getElementById('<%=txtEmail.ClientID%>').value
hope this will work in code.
Shivaraj Poojary69 reputationPosted Dec 10, 2011, 12:24 AM EST
Satyapriya NayakRank #47 · 31.5K reputationPosted Dec 10, 2011, 12:36 AM EST
Try this...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Get_value_Textbox_javascript._Default" %>
Thanks
If this post helps you mark it as answer
Satyapriya NayakRank #47 · 31.5K reputationPosted Dec 10, 2011, 12:47 AM EST
Another way of doing it.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Get_value_Textbox_javascript._Default" %>
Thanks
If this post helps you mark it as answer
Mayur GujrathiRank #666 · 3.6K reputationPosted Dec 10, 2011, 12:50 AM EST
In javascript write this
Shivaraj Poojary69 reputationPosted Dec 10, 2011, 1:13 AM EST
Sam HobbsRank #107 · 20.5K reputationPosted Dec 10, 2011, 11:43 AM EST