Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

datagridview row header not visible in windows form application

$
0
0

Hi friends

 the following is my code for generate datatable and bind to datagridview.in this i set row header text in gridview but it does not appear in ouptput.

 DataTable result= userdao.getdateanddayfortimetable1(comp);
            DataTable  period = userdao.getperiodfortimetable();
            int periodcount = period.Rows.Count;
            int daycount = result.Rows.Count;
            DataTable dt = new DataTable();
            for (int i = 0; i < periodcount; i++)
            {
                dt.Columns.Add();
            }
            for (int j = 0; j < daycount; j++)
            {
                dt.Rows.Add();
            }


            for (int k = 0; k < periodcount; k++)
            {

                dt.Columns[k].ColumnName = period.Rows[k]["PeriodNo"].ToString() + "(" + period.Rows[k]["StartTime"].ToString() + "-" + period.Rows[k]["EndTime"].ToString()+ ")";
            }
            PLayer.TimeTable timetable = new PLayer.TimeTable();
            timetable.timetablegrid.DataSource = dt;

            for (int i = 0; i < daycount; i++)
            {
                timetable.timetablegrid.Rows[i].HeaderCell.Value = result.Rows[i]["Working_day"].ToString();
                //timetable.timetablegrid.RowTemplate.Height = 25;
                //timetable.timetablegrid.RowHeadersDefaultCellStyle.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;
            }
                        timetable.Show();


Viewing all articles
Browse latest Browse all 12583

Trending Articles