This is a migrated thread and some comments may be shown as answers.

[Solved] Grid Detail Table Problem

2 Answers 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sharon
Top achievements
Rank 2
Sharon asked on 29 Dec 2009, 06:37 AM
Hi

I am having a problem with my Grid Detail Table.

I have a grid and in the grid i have 2 template column, in one there is a textbox and in the other there is a numeric textbox. when i click the save button the rows in the grid has to be saved. i have also set a detail table in the grid.To get the value of each template field the code i have used is
protected void btnSave_Click(object sender, EventArgs e)
    {
if (!string.IsNullOrEmpty(((RadNumericTextBox)gvSupplierInvoice.Items[Index].FindControl("txtSuppliedQuantity")).Text))
           {
               decimal SuppliedQuantity = Convert.ToDecimal(((RadNumericTextBox)gvSupplierInvoice.Items[Index].FindControl("txtSuppliedQuantity")).Text);
               this.oFdrSuplInvDtls.Entity.SID_QTY = Convert.ToDecimal(SuppliedQuantity);
           }
}

Now when i try to save the data in the grid with the detail table in the expanded form i am not getting the value in the template column.Hence am getting an error message. This happens only if the detail grid is in the expanded form. Could anybody help me with this

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 29 Dec 2009, 09:14 AM
Hello Sharon,

You would have to differentiate between the MasterTableView and the child table items. Can you try the following code and see if it makes a difference:
c#:
protected void btnSave_Click(object sender, EventArgs e) 
  { 
    if(!string.IsNullOrEmpty(((RadNumericTextBox)gvSupplierInvoice.MasterTableView.Items[Index].FindControl("txtSuppliedQuantity")).Text)) 
     { 
        decimal SuppliedQuantity = Convert.ToDecimal(((RadNumericTextBox)gvSupplierInvoice.MasterTableView.Items[Index].FindControl("txtSuppliedQuantity")).Text); 
        this.oFdrSuplInvDtls.Entity.SID_QTY = Convert.ToDecimal(SuppliedQuantity); 
     } 
  } 

Thanks
Princy.
0
Sharon
Top achievements
Rank 2
answered on 29 Dec 2009, 10:01 AM
hi Princy

Thank u very much its working perfectly now

Regards
Sharon
Tags
Grid
Asked by
Sharon
Top achievements
Rank 2
Answers by
Princy
Top achievements
Rank 2
Sharon
Top achievements
Rank 2
Share this question
or