c# - Show hide controls Based on DropDown Change Event -


we have 1 inventory page, need fill value 70 columns i.e 70 diff type of controls.

but customer want enter mandatory column based on specific drop-down type selection , don't want view non mandatory controls. want page map column mandatory type

example:

for student college mandatory field , company non mandatory field customer want see college text-box alone not company text-box employee college , company both mandatory customer want see both text box.

tried using jquery few controls performance 70 controls performance bad. there other way effectively.

70 input controls , 70 labels there in page controls visibility has changes based on single drop-down change event.

jquery function;

function getcontrolvisiblitybyassetid(assetid) {             var service = getabsolutepath() + "/services/cmdbservices.asmx/getcontrolvisiblitybyassetid"             $.ajax({                 type: "post",                 url: service,                 data: "{'assetid' : '" + assetid + "'}",                 contenttype: "application/json; charset=utf-8",                 datatype: "json",                 success: function (response) {                     var reference = (typeof response.d) == 'string' ? eval('(' + response.d + ')') : response.d;                     (var j = 0; j < reference.length; j++) {                         controlname[j] = reference[j].controlname;                         isvisible[j] = reference[j].isvisible;                         controltype[j] = reference[j].controltype;                         if (isvisible[j]) {                             $("\"" + getselectortype(controltype[j]) + "\"[id$=" + controlname[j] + "]").show();                         }                         else {                             $("\"" + getselectortype(controltype[j]) + "\"[id$=" + controlname[j] + "]").hide();                         }                     }                 }             });         }  function getselectortype(controltype) {             switch (controltype) {                 case 'textbox':                     return "input";                     break;                 case 'dropdown':                     return "select";                     break;                 case 'lable':                     return;                     break;             }         } 

you can use jquery purpose.

in jquery use hide() , show() or slidetoggle() functions purpose.

since, dont have particular code, can not write whole code here.

but referance can @ following links:

1. slidetoggle():

http://api.jquery.com/slidetoggle/

2. hide() :

http://api.jquery.com/hide/

3. show() :

http://api.jquery.com/show/

hope helpful.


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -