Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Editable Nested GridView in asp.net

$
0
0

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.

error
This is my code

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();
}

<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.




Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>