Get value of radInput at server assigned at client side

4 posts, 0 answers
  1. John
    John avatar
    8 posts
    Member since:
    Feb 2012

    Posted 24 Apr 2013 Link to this post

    Hi,
    I am setting value of RadInput control at client side which works fine. When I try to access the same value at code behind (txtbox.Text) - it has no value and shows empty.

    at Client side I am using:
    $find('<%= txtCustomerNumber.ClientID%>').set_value('Hello World');
    

    at Server side I am using
    Label1.Text = txtCustomerNumber.Text
    


    Regards,
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Apr 2013 Link to this post

    Hi,

    One suggestion is that you can use hidden fields instead, set their value client value client-side and then  get value on the server.
    JS:
    $find('<%= txtCustomerNumber.ClientID%>').set_value('Hello World');
       var hidden = document.getElementById("HiddenField1");
       hidden.value = $find('txtCustomerNumber').get_value();
    C#:
    HiddenField1.Value= txtCustomerNumber.Text;

    Thanks,
    Shinu
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. John
    John avatar
    8 posts
    Member since:
    Feb 2012

    Posted 25 Apr 2013 Link to this post

    Hi Shinu,

       Thank you for your reply but that can't be the best solution if we have more textboxes on the form. I had thought for this solution but ended up the situation coz of maintenance of 10 textboxes and 10 hidden fields.
     
       There should be proper solution (valid client side method to set value to textbox which can give value at server side) as normal asp.net textbox works fine in this situation.

    Regards,
    John 
  5. John
    John avatar
    8 posts
    Member since:
    Feb 2012

    Posted 25 Apr 2013 Link to this post

    Hi,

    Found the problem and solution as well.
      Actually my textbox was disabled as it was my requirement. but now I have made it readonly and it works fine.

    Regards,
    John
Back to Top