Pandit Pandit - 1 month ago 11
ASP.NET (C#) Question

How to set disabled controls value at client side using jQuery ASP.NET?

For ex. if server control disable like

txtScore.Enable=false;

Is there any way I can assign calculated value at client side using jQuery and get it at server side?

Dev Dev
Answer
  • Server disabled controls not get affect at client side. So if you try to set value it will not set its value
  • So need to disabled control using "disabled" attribute txtScore.Attributes.Add("disabled","disabled")
  • Using this attribute control can not be editable but we can set its value at client side
  • Set calculated value at client side using jQuery
  • $("#txtScore").val(calculated value);
  • Get value at server side using txtScore.Text