C# 无法编辑嵌套的gridview,提供错误附加信息:语法错误:在'之后缺少操作数;fa9bb79';操作人员
绑定子网格视图时出错。errro-在“fa9bb79”运算符后缺少操作数。单击父表时,应绑定未发生的子表值。我在这一行中遇到错误-“” 网格视图C# 无法编辑嵌套的gridview,提供错误附加信息:语法错误:在'之后缺少操作数;fa9bb79';操作人员,c#,asp.net,gridview,C#,Asp.net,Gridview,绑定子网格视图时出错。errro-在“fa9bb79”运算符后缺少操作数。单击父表时,应绑定未发生的子表值。我在这一行中遇到错误-“” 网格视图 <asp:GridView ID="gvParent" runat="server" AutoGenerateColumns="False" OnRowDataBound="gvParent_RowDataBound" CellPadding="4" ForeColor="#333333" ShowHeader="True" DataKeyNam
<asp:GridView ID="gvParent" runat="server" AutoGenerateColumns="False" OnRowDataBound="gvParent_RowDataBound"
CellPadding="4" ForeColor="#333333" ShowHeader="True" DataKeyNames="uniqueid">
<Columns>
<asp:TemplateField ItemStyle-Width="20px">
<ItemTemplate>
<asp:Image runat="server" ID="img1" ImageUrl="img/Collapse.GIF" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Employee Id" DataField="ToAddress">
<ItemStyle HorizontalAlign="Center" Width="160px" />
</asp:BoundField>
<asp:BoundField HeaderText="Employee Name" DataField="PODate">
<ItemStyle HorizontalAlign="Center" Width="160px" />
</asp:BoundField>
<asp:BoundField HeaderText="Designation" DataField="PoNo">
<ItemStyle HorizontalAlign="Center" Width="160px" />
</asp:BoundField>
<asp:TemplateField HeaderText="Location">
<ItemTemplate>
<asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("Description")%>'></asp:Label>
<asp:Literal runat="server" ID="lit1" Text="</td><tr id='trCollapseGrid' style='display:none' ><td colspan='5'>" />
<asp:GridView ID="gvChild" AutoGenerateColumns="False" runat="server" EnableViewState="False"
DataKeyNames="uid" ForeColor="#333333" PageSize="2" AllowPaging="True"
OnPageIndexChanging="gvChild_PageIndexChanging" OnRowCancelingEdit="gvChild_RowCancelingEdit"
OnRowDeleting="gvChild_RowDeleting" OnRowEditing="gvChild_RowEditing" OnRowUpdating="gvChild_RowUpdating">
<RowStyle BackColor="#EFF3FB" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField HeaderText="Skill ID" DataField="uid" ReadOnly="True">
<ItemStyle HorizontalAlign="Center" Width="80px" />
</asp:BoundField>
<asp:BoundField HeaderText="Employee Id" DataField="Comments" ReadOnly="True">
<ItemStyle HorizontalAlign="Center" Width="100px" />
</asp:BoundField>
<asp:TemplateField HeaderText="PartNo">
<ItemStyle HorizontalAlign="Center" Width="100px" />
<ItemTemplate>
<%# Eval("PartNo")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEditSkillSet" runat="server" Text=' <%# Eval("Qty")%>' Width="100px"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Remarks">
<ItemStyle HorizontalAlign="Center" Width="100px" />
<ItemTemplate>
<%# Eval("unitprice")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEditRemarks" runat="server" Text=' <%# Eval("unitprice")%>' Width="100px"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Button" EditText="Edit" HeaderText="Edit" ShowEditButton="true" />
<asp:CommandField ButtonType="Button" DeleteText="Delete" HeaderText="Delete" ShowDeleteButton="true" />
</Columns>
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
</asp:GridView>
private void BindChildgvwChildView(string empId, System.Web.UI.WebControls.GridView gvChild)
{
DataTable dtChildTable = GetChildTableData();
DataTable dtCloneChildTable = dtChildTable.Clone();
DataRow[] gvChildRows = dtChildTable.Select("uid = " + empId);//2fa9bb79-7d0b-4e38-853c-d275d5d634c2
// DataRow[] gvChildRows = dtChildTable.Select("uid = " + empId);
// 2FA9BB79-7D0B-4E38-853C-D275D5D634C2
foreach (DataRow gvChildRow in gvChildRows)
{
dtCloneChildTable.ImportRow(gvChildRow);
}
gvChild.DataSource = dtCloneChildTable;
gvChild.DataBind();
}
私有void BindChildgvwChildView(字符串empId,System.Web.UI.WebControls.GridView gvChild)
{
DataTable dtChildTable=GetChildTableData();
DataTable dtCloneChildTable=dtChildTable.Clone();
DataRow[]gvChildRows=dtChildTable。选择(“uid=“+empId”);//2fa9bb79-7d0b-4e38-853c-d275d5d634c2
//DataRow[]gvChildRows=dtChildTable.Select(“uid=“+empId”);
//2FA9BB79-7D0B-4E38-853C-D275D5D634C2
foreach(gvChildRows中的数据行gvChildRow)
{
dtCloneChildTable.ImportRow(gvChildRow);
}
gvChild.DataSource=dtCloneChildTable;
gvChild.DataBind();
}
<asp:GridView ID="gvParent" runat="server" AutoGenerateColumns="False" OnRowDataBound="gvParent_RowDataBound"
CellPadding="4" ForeColor="#333333" ShowHeader="True" DataKeyNames="uniqueid">
<Columns>
<asp:TemplateField ItemStyle-Width="20px">
<ItemTemplate>
<asp:Image runat="server" ID="img1" ImageUrl="img/Collapse.GIF" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Employee Id" DataField="ToAddress">
<ItemStyle HorizontalAlign="Center" Width="160px" />
</asp:BoundField>
<asp:BoundField HeaderText="Employee Name" DataField="PODate">
<ItemStyle HorizontalAlign="Center" Width="160px" />
</asp:BoundField>
<asp:BoundField HeaderText="Designation" DataField="PoNo">
<ItemStyle HorizontalAlign="Center" Width="160px" />
</asp:BoundField>
<asp:TemplateField HeaderText="Location">
<ItemTemplate>
<asp:Label ID="lblEmpName" runat="server" Text='<%# Eval("Description")%>'></asp:Label>
<asp:Literal runat="server" ID="lit1" Text="</td><tr id='trCollapseGrid' style='display:none' ><td colspan='5'>" />
<asp:GridView ID="gvChild" AutoGenerateColumns="False" runat="server" EnableViewState="False"
DataKeyNames="uid" ForeColor="#333333" PageSize="2" AllowPaging="True"
OnPageIndexChanging="gvChild_PageIndexChanging" OnRowCancelingEdit="gvChild_RowCancelingEdit"
OnRowDeleting="gvChild_RowDeleting" OnRowEditing="gvChild_RowEditing" OnRowUpdating="gvChild_RowUpdating">
<RowStyle BackColor="#EFF3FB" />
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:BoundField HeaderText="Skill ID" DataField="uid" ReadOnly="True">
<ItemStyle HorizontalAlign="Center" Width="80px" />
</asp:BoundField>
<asp:BoundField HeaderText="Employee Id" DataField="Comments" ReadOnly="True">
<ItemStyle HorizontalAlign="Center" Width="100px" />
</asp:BoundField>
<asp:TemplateField HeaderText="PartNo">
<ItemStyle HorizontalAlign="Center" Width="100px" />
<ItemTemplate>
<%# Eval("PartNo")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEditSkillSet" runat="server" Text=' <%# Eval("Qty")%>' Width="100px"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Remarks">
<ItemStyle HorizontalAlign="Center" Width="100px" />
<ItemTemplate>
<%# Eval("unitprice")%>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEditRemarks" runat="server" Text=' <%# Eval("unitprice")%>' Width="100px"></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Button" EditText="Edit" HeaderText="Edit" ShowEditButton="true" />
<asp:CommandField ButtonType="Button" DeleteText="Delete" HeaderText="Delete" ShowDeleteButton="true" />
</Columns>
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
</asp:GridView>
private void BindChildgvwChildView(string empId, System.Web.UI.WebControls.GridView gvChild)
{
DataTable dtChildTable = GetChildTableData();
DataTable dtCloneChildTable = dtChildTable.Clone();
DataRow[] gvChildRows = dtChildTable.Select("uid = " + empId);//2fa9bb79-7d0b-4e38-853c-d275d5d634c2
// DataRow[] gvChildRows = dtChildTable.Select("uid = " + empId);
// 2FA9BB79-7D0B-4E38-853C-D275D5D634C2
foreach (DataRow gvChildRow in gvChildRows)
{
dtCloneChildTable.ImportRow(gvChildRow);
}
gvChild.DataSource = dtCloneChildTable;
gvChild.DataBind();
}