总是提示:索引超出范围。必须为非负值并小于集合大小。
参数名: index
下面是部分代码:
for (i = 0; i <=dv.Tables[0].Rows.Count-1; i++)
{
GridView1.Rows[i].Cells[1].Text = dv.Tables[0].Rows[i]["D13"].ToString();
//GridView1.Rows[i].Cells[1].Text = dv.Tables[0].Rows[i]["Tcbh"].ToString();
GridView1.Rows[i].Cells[2].Text = dv.Tables[0].Rows[i]["d16"].ToString();
GridView1.Rows[i].Cells[3].Text = dv.Tables[0].Rows[i]["D14a"].ToString();
GridView1.Rows[i].Cells[4].Text = dv.Tables[0].Rows[i]["sszy"].ToString();
GridView1.Rows[i].Cells[5].Text = dv.Tables[0].Rows[i]["Gd1"].ToString();
GridView1.Rows[i].Cells[6].Text = dv.Tables[0].Rows[i]["D20"].ToString();
设计代码:
asp:GridView ID="GridView1" runat="server" Width="635px" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:ButtonField Text="详细查询" HeaderText="详细查询" />
<asp:BoundField HeaderText="姓名" ReadOnly="True" DataField="D13" />
<asp:BoundField HeaderText="性别" DataField="D16" />
<asp:BoundField HeaderText="部门" DataField="D14a" />
<asp:BoundField HeaderText="专业" DataField="sszy" />
<asp:BoundField HeaderText="学历" DataField="D30" />
<asp:BoundField HeaderText="工作时间" DataField="D20" />
<asp:BoundField HeaderText="培养主责人" DataField="pyzzr" />
<asp:BoundField HeaderText="培养直接责任人" DataField="pyds" />
<asp:BoundField HeaderText="总体培养目标" DataField="zongtimb" />
<asp:BoundField HeaderText="年度" DataField="pynd" />
<asp:BoundField HeaderText="年度培养目标" DataField="ndmb" />
<asp:BoundField HeaderText="年度考核" DataField="ndjg" />
<asp:BoundField HeaderText="月度" DataField="pyyd" />
<asp:BoundField HeaderText="月度考核" DataField="ydjg" />
<asp:BoundField HeaderText="学习纪录" DataField="ydxuexijl" />
<asp:BoundField HeaderText="月度学习报告" DataField="grxxbg" />
</Columns>
小弟实在想不出来怎么办了,求各位帮帮忙!急!!!急!!!急!!!谢谢了!