You must Sign In to post a response.
  • Category: ASP.NET

    Unable to get value in page load asp.net when value set by jquey.

    i am working i a business application.where i load data in grid view on page load. i have to set
    search criteria from client set.when i set value in control then it display in html.but this value not
    change in page load.
    my client side code is
    <script type="text/javascript">
    $(document).ready(function () {
    $("hfServerValue").val("From ClientSide!");
    });
    </script>
    my server side code is //
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Response.Write(" & hfServerValue.Value & )
    End Sub
  • #769949
    if i understood your question correctly then below are correct observations
    1. you are assigning values to the hidden control using jquery- and it may be on some event or document readystate
    2. you are displaying this control value on page_load which is always executing from serve side

    please note that, after server side execution done i.e page_load then only your client logic will execute ad assign the value. even if you are assigning the value in some event on page_Load all the values will get cleared and freshly it loads the content of the all server controls.

    my suggestion is, try to access the control value through some ajax event or serve control event, so that you will get the client side assigned value

    Thanks!
    B.Ramana Reddy


  • Sign In to post your comments