Step 2: first fill the first drop-down box with data in the load
dgvCmbObligorType.DataSource = dtPayer; dgvCmbObligorType.DisplayMember = "name"; dgvCmbObligorType.ValueMember = "id";
Step 2: Use the maid cellvaluechanged event to complete the Association
Private void maid (Object sender, maid e) {If (E. rowindex> = 0) {If (E. columnindex = 0) {If (datagridview1.rows [E. rowindex]. cells [0]. value! = NULL) {string id = maid [E. rowindex]. cells [0]. value. tostring (); datagridview1.rows [E. rowindex]. cells [0]. tag = ID; // obtain the owner according to the type if (ID = "2") // courier {string SQL = "Exec srmaster .. usp_getposter "; datatable dt = srwebclient. webClient. handler. dataclient. getdatatable (SQL); maid cell = maid [E. rowindex]. cells [1] as maid; cell. datasource = DT; cell. displaymember = "name"; cell. valuemember = "ID"; maid [E. rowindex]. cells [2]. value = "0";} else if (ID = "3") // site {string SQL = "select * From srmaster .. department where depcid in (800,801,802) order by name "; datatable dt = srwebclient. webClient. handler. dataclient. getdatatable (SQL); maid cell = maid [E. rowindex]. cells [1] As datagridviewcom Boboxcell; cell. datasource = DT; cell. displaymember = "name"; cell. valuemember = "ID"; maid [E. rowindex]. cells [2]. value = "0" ;}}} else if (E. columnindex = 1) {If (datagridview1.rows [E. rowindex]. cells [1]. value! = NULL) {string id = maid [E. rowindex]. cells [1]. value. tostring (); datagridview1.rows [E. rowindex]. cells [1]. tag = ID ;}}}}