Click here to Skip to main content
15,895,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everybody,

I have a NestedGridView with scrollable option. Now, I need to update child grid details but i have Edit button on my parent grid. But what's the problem is when i try to update the value 3 to 30, the return value should be 30 but instead of that it's showing 3,30. For this i'm trying alot but i'm unable to findout the solution out of this. May i know the reason to show the quantity like this.

I know the logic for editing and updating so please don't provide any link. I want to know the reason to show the value 3,30.

This is my code

C#
protected void GV_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
    Design obj = new Design();
    string Material_Id = ((Label)GV.Rows[e.RowIndex].FindControl("lblMaterial_Id")).Text;
    string Grade_Id = ((Label)GV.Rows[e.RowIndex].FindControl("lblGrade_Id")).Text;
    string Item_Id = ((Label)GV.Rows[e.RowIndex].FindControl("lblItem_Id")).Text;
    DataList dl = (DataList)GV.Rows[e.RowIndex].FindControl("dlBuilding_Row");
    foreach (DataListItem dli in dl.Items)
    {
        string Quantity = ((TextBox)dli.FindControl("txtQuantity")).Text;
        string Building_Id = ((Label)dli.FindControl("lblStructure")).Text;
        string Result = obj.Update_Tender_Quantity_Details(Proj_Code, ddlDiscipline.SelectedValue, Building_Id, Material_Id, Grade_Id, Item_Id, Quantity, dUserId.ToString());
         MsgBox1.alert(Result);
    }
    GV.EditIndex = -1;
    Bind_GV();
}


C#
<asp:GV>
    <ItemTemplate>  
      <asp:DataList ID="dlBuilding_Row" runat="server" RepeatDirection="Horizontal" Width="100%" ItemStyle-HorizontalAlign="Center" >      
        <ItemTemplate>                                                          
          <asp:Label ID="lblQuantities" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Quantity") %>'  Width="30px"></asp:Label>
          <asp:Label ID="lblStructure" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Building_Id") %>' Visible="false"></asp:Label>
        </ItemTemplate>
     </asp:DataList>
   </ItemTemplate>
   <EditItemTemplate>
     <asp:DataList ID="dlBuilding_Row" runat="server" RepeatDirection="Horizontal" Width="100%" ItemStyle-HorizontalAlign="Center" >
      <ItemTemplate>
           <asp:TextBox ID="txtQuantity" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Quantity") %>' Width="30px"></asp:TextBox>
           <asp:Label ID="lblStructure" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Building_Id") %>' Visible="false"></asp:Label>
       </ItemTemplate>
   </asp:DataList>
</EditItemTemplate>
</asp:GV>


Can any one give me some better solution out of this..

Note: If i use datalist id is different i'm unable to edit the row why because for that id there is no data. That's the reason i'm using same id for itemtemplate and edititemtemplate also.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900