ASP.NET Web Forms FAQ: Bagaimana cara untuk mengambil variabel server-side menggunakan kode JavaScript RRS feed

  • Diskusi Umum

  • <asp:HiddenField ID="HiddenField1" runat="server" />  


      public partial class LoginDemo : System.Web.UI.Page 


        private string str="hello"; 

        protected void Page_Load(object sender, EventArgs e) 






    Kemudian Anda dapat mengakses control HiddenField1 menggunakan javascipt:


    <script type="text/JavaScript"> 
    Var tt=document.getElementByID(“HiddenField1”); 

    Thread terkait:  

    Agnes Sannie [MSFT]

    MSDN Community Support | Feedback to us

    Get or Request Code Sample from Microsoft

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Rabu, 03 Agustus 2011 08.58