This topic is locked

How to hide/show control along with its label on Add/Edit pages

1/9/2014 10:46:11 PM
ASPRunnerPro Tips and tricks
admin

ASPRunnerPro manual comes with example of hiding/showing controls on Add/Edit pages based on another control value:

http://xlinesoft.com/asprunnerpro/docs/show_dropdown_list_of_us_states.htm
For better user experience you may want to hide field label as well. Here is the sample code. This code will work with ASPRunnerPro 8.0 and single column Add/Edit page layout.

var ctrlCountry = Runner.getControl(pageid, 'country');



ctrlCountry.on('change', function(e){

if (this.getValue() == 'US'){

$("tr[data-fieldname='state']").show();

}else{

$("tr[data-fieldname='state']").hide();

}

});


This is it, the whole table row with state edit control will be hidden or shown based on country field selection.