This is a migrated thread and some comments may be shown as answers.

Get value of radInput at server assigned at client side

3 Answers 65 Views
Input
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 24 Apr 2013, 01:59 PM
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,

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 25 Apr 2013, 06:22 AM
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
0
John
Top achievements
Rank 1
answered on 25 Apr 2013, 08:19 AM
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 
0
John
Top achievements
Rank 1
answered on 25 Apr 2013, 11:40 AM
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
Tags
Input
Asked by
John
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
John
Top achievements
Rank 1
Share this question
or