6
Answers

how to set the dropdown dependency in javascript using c#

mohan raj

mohan raj

11y
1.1k
1
Hi This Mohan,


my javascript code is 

var states = new Array();
 states['science'] = new Array('Select', 'PCMB', 'PCMC');
 states['commerce'] = new Array('Select', 'SEBA','HEBA'); 
states['arts'] = new Array('Select', 'HEPS'); 
 function setStates()
 {
 cntrySel = document.getElementById('ddlbranch');
 stateList = states[cntrySel.value]; 
 changeSelect('ddlsubcategory', stateList, stateList);
 setCities();
 }

 function changeSelect(fieldID, newOptions, newValues) 
{
 selectField = document.getElementById(fieldID);
 selectField.options.length = 0;
 for (i = 0; i < newOptions.length; i++) 
 selectField.options[selectField.length] = new Option(newOptions[i], newValues[i]);
 }
 }
 function addLoadEvent(func)
 { 
 var oldonload = window.onload;
 if (typeof window.onload != 'function')
 { 
 window.onload = func; 
 }
 else
 {
 window.onload = function ()
 {
 if (oldonload)
 {
 oldonload();
 }
 func(); 
 }
 }
 }
 addLoadEvent(function () { setStates(); });

when i use this code it's working but not storing the Database

my C# code is
 obj.Combination = ddlsubcategory.Text;

ples help me how to solve this problem.
Answers (6)