1, the main code:
Private voidForm3_load (Objectsender, EventArgs e) {DataTable dt=NewDataTable (); Dt. Columns.Add ("HZ"); Dt. Columns.Add ("PY",typeof(Object)); Dt. Rows.Add (1,1); Dt. Rows.Add (2,2); Gridcontrol1.datasource=DT; } Private voidGridview1_customrowcelledit (Objectsender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e) { if(E.column.fieldname = ="PY") { if(E.rowhandle = =0) {Repositoryitemradiogroup rig=NewRepositoryitemradiogroup (); Radiogroupitem Item=NewRadiogroupitem (); Item. Description="S"; Item. Value=1; Radiogroupitem item1=NewRadiogroupitem (); Item1. Description="Y"; Item1. Value=3; Rig. Items.Add (item); Rig. Items.Add (ITEM1); Rig. Parseeditvalue+=Rig_parseeditvalue; E.repositoryitem=rig; } Else if(E.rowhandle = =1) {Repositoryitemradiogroup rig1=NewRepositoryitemradiogroup (); Radiogroupitem item2=NewRadiogroupitem (); Item2. Description="M"; Item2. Value=2; Radiogroupitem Item3=NewRadiogroupitem (); Item3. Description="N"; Item3. Value=4; Rig1. Items.Add (ITEM2); Rig1. Items.Add (ITEM3); E.repositoryitem=RIG1; } } }
2.:
3. The instance uses the same control, and different controls simply replace the controls that are added inside the method.
GridView cell binding different control methods