get value label asp.net from scripts to CodeBehinde RRS feed

  • Question

  • User2093830819 posted

    i have problem in my website :

    this code i write hime in codeBehinde :

    public void page_load

    val.text = device .text

    for example i can't get anything 

    Saturday, September 12, 2020 3:54 PM

All replies

  • User409696431 posted

    page_load is server-side event.  It occurs before your client-side JavaScript runs.  When page_load happens, your labels have no values, so your result is expected.

    What are you trying to do with those values?

    If you are trying to send the values to the server (code behind) for some purpose, you could check the following page, https://www.c-sharpcorner.com/article/ajax-in-asp-net/

    Scroll down to the "AJAX in ASP.NET WebForms" section, and look at the illustration of how to send information to the server, captured by a [WebMethod] function defined in the code behind.  The example uses the JQuery JavaScript library.

    Saturday, September 12, 2020 4:50 PM