none
ASP.NET Web Forms FAQ: Bagaimana menetapkan nilai ke hidden field menggunakan JavaScript dalam ASP.NET? RRS feed

  • Diskusi Umum

  • Kita dapat menggunakan JavaScript untuk mengatur nilai dari suatu hidden kontrol dan mendapatkan nilainya di server setelah postback.

    <input id="Hidden1" type="hidden" /> 

    <script type="text/JavaScript"> 

    var str=”hello” 

    document.getElementByID(“Hidden1”).value=str 

    </script>

     

    protected void Page_Load(object sender, EventArgs e) 
    { 
        string str=request["Hidden1"].ToString(); 
    }

     

    Thread terkait: http://forums.asp.net/p/1262153/2362090.aspx


    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.
    Kamis, 04 Agustus 2011 04.38
    Moderator