我没分了,所以分不多。请指点。CS0103: 当前上下文中不存在名称“GridView2”我的嵌套。前台代码:
<asp:GridView ID="TrainPerson_gv" runat="server" AutoGenerateColumns="False" Width="672px">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td height="27" colspan="3" align="left" bgcolor="#cad0d7"><span class="Style_13px_ffffff_B"> </span><span class="Style_12px_333333_B">部门:<%#DataBinder.Eval(Container.DataItem,"INFO_NAME") %></span> <asp:Label ID="INFO_ID" runat="server" Visible="false"></asp:Label>
<asp:CheckBox ID="CheckBox1" runat="server" />
<span class="LastMap">本部门全选</span></td>
</tr>
<tr>
<td height="30" colspan="3" align="left"><table height="29" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="33" height="22" align="right">
<asp:GridView ID="GridView2" runat="server" Width="100%" AutoGenerateColumns="False" ShowHeader="False" BorderStyle="Solid" BorderColor="#C0C0FF" BorderWidth="1px" OnRowCreated="GridView2_RowCreated">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table width="100%" border="0">
<tr>
<td> </td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle BorderColor="#C0C0FF" BorderStyle="Solid" />
</asp:GridView>
</td>
<td width="60"> </td> </tr>
</table> </td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>后台:
string TrainPerson = "select distinct a.P_DEPARTMENT,b.INFO_ID,b.INFO_NAME,b.INFO_LEADER from RS_Person a,RS_D_INFOMATION b where a.P_DEPARTMENT = b.INFO_ID ";//联合查询,表内数据
if (!IsPostBack)
{
Tongyong.SetLinkMaps(RightMaps1, "人事管理", "../RsManage/Right_Content.aspx", "_self", "培训管理", "", "", "培训管理", "LastMap");
//TrainPerson = TrainPerson + "";
Bind();
} } protected void Bind()
{
//部门的绑定循环
DataSet ds = DbClass.getDateSet(TrainPerson);
int i = ds.Tables[0].Rows.Count;
_TrainPerson.RecordCount = i.ToString();
DbClass.BindGridView(TrainPerson, TrainPerson_gv);
//部门绑定结束
//根据类编号获得旗下版块
for (int g = 0; g < ds.Tables[0].Rows.Count; i++)
{ string TrainMan = "select P_ID,P_NAME from RS_Person where P_DEPARTMENT =" + ds.Tables[0].Rows[g]["INFO_ID"].ToString();
DataSet ds1 = DbClass.getDateSet(TrainMan);
int k = ds1.Tables[0].Rows.Count;
_TrainPerson.RecordCount = k.ToString();
DbClass.BindGridView1(TrainMan, GridView2); } }
当前上下文中不存在名称“GridView2”
<asp:GridView ID="TrainPerson_gv" runat="server" AutoGenerateColumns="False" Width="672px">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr>
<td height="27" colspan="3" align="left" bgcolor="#cad0d7"><span class="Style_13px_ffffff_B"> </span><span class="Style_12px_333333_B">部门:<%#DataBinder.Eval(Container.DataItem,"INFO_NAME") %></span> <asp:Label ID="INFO_ID" runat="server" Visible="false"></asp:Label>
<asp:CheckBox ID="CheckBox1" runat="server" />
<span class="LastMap">本部门全选</span></td>
</tr>
<tr>
<td height="30" colspan="3" align="left"><table height="29" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="33" height="22" align="right">
<asp:GridView ID="GridView2" runat="server" Width="100%" AutoGenerateColumns="False" ShowHeader="False" BorderStyle="Solid" BorderColor="#C0C0FF" BorderWidth="1px" OnRowCreated="GridView2_RowCreated">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<table width="100%" border="0">
<tr>
<td> </td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle BorderColor="#C0C0FF" BorderStyle="Solid" />
</asp:GridView>
</td>
<td width="60"> </td> </tr>
</table> </td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>后台:
string TrainPerson = "select distinct a.P_DEPARTMENT,b.INFO_ID,b.INFO_NAME,b.INFO_LEADER from RS_Person a,RS_D_INFOMATION b where a.P_DEPARTMENT = b.INFO_ID ";//联合查询,表内数据
if (!IsPostBack)
{
Tongyong.SetLinkMaps(RightMaps1, "人事管理", "../RsManage/Right_Content.aspx", "_self", "培训管理", "", "", "培训管理", "LastMap");
//TrainPerson = TrainPerson + "";
Bind();
} } protected void Bind()
{
//部门的绑定循环
DataSet ds = DbClass.getDateSet(TrainPerson);
int i = ds.Tables[0].Rows.Count;
_TrainPerson.RecordCount = i.ToString();
DbClass.BindGridView(TrainPerson, TrainPerson_gv);
//部门绑定结束
//根据类编号获得旗下版块
for (int g = 0; g < ds.Tables[0].Rows.Count; i++)
{ string TrainMan = "select P_ID,P_NAME from RS_Person where P_DEPARTMENT =" + ds.Tables[0].Rows[g]["INFO_ID"].ToString();
DataSet ds1 = DbClass.getDateSet(TrainMan);
int k = ds1.Tables[0].Rows.Count;
_TrainPerson.RecordCount = k.ToString();
DbClass.BindGridView1(TrainMan, GridView2); } }
当前上下文中不存在名称“GridView2”
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货