Click here to Skip to main content
15,924,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends

i have develop two windows form .
in first form

the code for add row and column and set the rowheader text. the code is below
DataTable dt = new DataTable();

           for (int i = 0; i < columncount; i++)
           {
               dt.Columns.Add();
           }
           for (int j = 0; j < rowcount; j++)
           {
               dt.Rows.Add();

           }


           dataGridView1.DataSource = dt;
           for( int i=0;i<rowcount;i++)
           {
               dataGridView1.Rows[i].HeaderCell.Value = (i + 1).ToString();
           }

This code works for setting headercell of rows in gridview. and in the another form gridview design for time table it does not show the row headercell.value. the code is
   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();


from yesterday i stuck with this problem. i dont know how to solve this problem. help me to solve this problem.
Thank you
Posted
Updated 23-Apr-13 20:56pm
v3
Comments
Naz_Firdouse 24-Apr-13 3:16am    
Don't post the same question again...
you already posted the same question here
http://www.codeproject.com/Questions/582486/datagridviewplusrowheaderplusvalueplusnotplusvisib?cmt=437686#cmt2_582486
Naz_Firdouse 24-Apr-13 3:19am    
Are you sure that the result datatable contains values with column name "Working_day"?
baskaran chellasamy 24-Apr-13 3:23am    
yes that table contain 4 days "monday,'tuesday' wednesday' thursday.
baskaran chellasamy 24-Apr-13 3:24am    
yes i posted the same question sorry for that. but i tried with my best to get result. but not able to find solution.so that once again post that question

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900