|代码页获取对应DataGrid的行的数据

|代码页获取对应DataGrid的行的数据


代码页获取对应DataGrid的行的数据
<asp:BoundColumn Visible=\"False\" DataField=\"tr_class_id\" HeaderText=\"id\"></asp:BoundColumn>
<asp:BoundColumn DataField=\"tr_class_name\" HeaderText=\"班名称\"></asp:BoundColumn>
<asp:BoundColumn DataField=\"tr_plan_id\" HeaderText=\"计划编号\"></asp:BoundColumn>
<asp:BoundColumn DataField=\"tr_type_name\" HeaderText=\"培训类别\"></asp:BoundColumn>
<asp:BoundColumn DataField=\"tr_class_type\" HeaderText=\"办班形式\"></asp:BoundColumn>
<asp:BoundColumn DataField=\"tr_class_address\" HeaderText=\"办班地点\"></asp:BoundColumn>
<asp:TemplateColumn HeaderText=\"开始时间\">
<ItemTemplate>
<asp:Label ID=\"one\" runat=\"server\" Text='<%# Convert.ToDateTime(DataBinder.Eval(Container \"DataItem.tr_class_stime\")).ToShortDateString() %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText=\"结束时间\">
<ItemTemplate>
<asp:Label ID=\"two\" runat=\"server\" Text='<%# Convert.ToDateTime(DataBinder.Eval(Container \"DataItem.tr_class_etime\")).ToShortDateString() %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn DataField=\"BanZhuRen\" HeaderText=\"班主任\"></asp:BoundColumn>
<asp:BoundColumn DataField=\"TianShu\" HeaderText=\"天数\"></asp:BoundColumn>
<asp:BoundColumn DataField=\"RenShu\" HeaderText=\"人数\"></asp:BoundColumn>
<asp:TemplateColumn HeaderText=\"班级状态\">
<ItemTemplate>
<asp:Label ID=\"status\" runat=\"server\" Text='<%# (DataBinder.Eval(Container \"DataItem.tr_class_status\").ToString() == \"1\") ? \"在读\" : \"结业\"%>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
----------------------------------------------------------------------------------
foreach (DataGridItem dgi in dgClass.Items)
{
CheckBox cb = (CheckBox)dgi.FindControl(\"chkbox\");
if (cb.Checked)
{
LblID.Text = dgi.Cells[1
.Text;
PlanName.Text = dgi.Cells[2
.Text;
DropDownList1.SelectedValue = https://mparticle.uc.cn/api/dgi.Cells[3
.Text;
DropDownList3.SelectedValue = https://mparticle.uc.cn/api/dgi.Cells[13
.Text;
DropDownList4.SelectedValue = https://mparticle.uc.cn/api/dgi.Cells[5
.Text;
TxtAdd.Text = dgi.Cells[6
.Text;
Txtstime.Text = (dgi.Cells[7
.FindControl(\"one\") as Label).Text;
Txtetime.Text = (dgi.Cells[8
.FindControl(\"two\") as Label).Text;
//txtStaffName.Text=dgi.Cells[9
.Text;
TxtStaff.Text = dgi.Cells[14
.Text;
txtTextBooks.Text = dgi.Cells[15
.Text.Trim();
string url = ((HyperLink)(dgi.Cells[16
.FindControl(\"hlPlanPath\"))).NavigateUrl;
lblPlanPath.Text = url.Substring(url.LastIndexOf(\"\\\\\") + 1);
DropDownList2.SelectedValue = https://mparticle.uc.cn/api/((dgi.Cells[8
.FindControl(\"status\") as Label).Text==\"在读\")?\"1\":\"0\";
break;

【|代码页获取对应DataGrid的行的数据】