Gridview control Problem
-
Hi all! I am creating a grid view control containing data and column coming from two different sources . 1)first two columns in grid control coming from 1 source with all the data like field_name1 and field_name2. 2) second having the 1 column(Table Field) in the table which is display as columns header text in the grid view control combin with the above grid view. Now the problem. All the time the 2) is appear first i want to show him in 2nd priority. 1) shoud be display first. below is the code for that
if (chkHealthPlanDP.Checked) { //grdByHealthPlanDP.Visible = true; System.Web.UI.WebControls.GridView DiseaseGrid = new GridView(); DiseaseGrid.DataSource = **REPORT_METRIC_ENTITYMIX.GetData(2);** //data coming from source one DiseaseGrid.DataBind(); DiseaseGrid.Width = 100; DiseaseGrid.Height = 50; DiseaseGrid.GridLines = GridLines.Both; DiseaseGrid.CellPadding = 0; DiseaseGrid.HeaderStyle.BackColor = System.Drawing.Color.Pink; foreach (Master_ref_disease masterDisease in **Master_reference_disease.result()** //source 2) { BoundField c = new BoundField(); c.HeaderText = masterDisease.D_ID; //c.DataField = masterDisease.D_ID; DiseaseGrid.Columns.Add(c); } PlaceHolder1.Controls.Add(DiseaseGrid); DiseaseGrid.DataBind(); }
-
Hi all! I am creating a grid view control containing data and column coming from two different sources . 1)first two columns in grid control coming from 1 source with all the data like field_name1 and field_name2. 2) second having the 1 column(Table Field) in the table which is display as columns header text in the grid view control combin with the above grid view. Now the problem. All the time the 2) is appear first i want to show him in 2nd priority. 1) shoud be display first. below is the code for that
if (chkHealthPlanDP.Checked) { //grdByHealthPlanDP.Visible = true; System.Web.UI.WebControls.GridView DiseaseGrid = new GridView(); DiseaseGrid.DataSource = **REPORT_METRIC_ENTITYMIX.GetData(2);** //data coming from source one DiseaseGrid.DataBind(); DiseaseGrid.Width = 100; DiseaseGrid.Height = 50; DiseaseGrid.GridLines = GridLines.Both; DiseaseGrid.CellPadding = 0; DiseaseGrid.HeaderStyle.BackColor = System.Drawing.Color.Pink; foreach (Master_ref_disease masterDisease in **Master_reference_disease.result()** //source 2) { BoundField c = new BoundField(); c.HeaderText = masterDisease.D_ID; //c.DataField = masterDisease.D_ID; DiseaseGrid.Columns.Add(c); } PlaceHolder1.Controls.Add(DiseaseGrid); DiseaseGrid.DataBind(); }
Why not take a Child Grid for showing records of dataSource 2