TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
baskaran chellasamy
NA
114
151k
cannot able to set row header value in datagridview
Apr 23 2013 4:08 PM
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
Reply
Answers (
0
)
Add text and image to link button
C program that deals with averages and volts/hours