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

DetailTable insert command

2 Answers 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
YUNUS EMRE
Top achievements
Rank 1
YUNUS EMRE asked on 11 Jul 2013, 12:59 PM
  Hi,

    I am using a radgrid with two detail tables. I wrote come code in InsertCommand of RadGrid.
But when i insert a detail record, InsertCommand fires.
I dont want that InsertCommand fires, when i insert detail record.

Could you suggest any solution for this?
Thanks.
Yunus

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 12 Jul 2013, 07:58 AM
Hi,

The insert command fires whenever the Insert link is clicked.One solution is by checking the Condition as to which table is being inserted.Try the below code snippet to access the Master or Detail table.

ASPX:
  <telerik:RadGrid ID="RadGrid1" oninsertcommand="RadGrid1_InsertCommand">        
  <MasterTableView  Name="Master" >
    <ParentTableRelation>
                 . . . . .
   </ParentTableRelation>
   <DetailTables>
           <telerik:GridTableView  Name="Details">
                  . . . . .                   
           </telerik:GridTableView>
   </DetailTables>
</MasterTableView>
</telerik:RadGrid>


C#:
protected void RadGridBlanketNew_InsertCommand(object sender, GridCommandEventArgs e)
{
    if (e.Item.OwnerTableView.Name == "Master")
    {
        //Your code for MasterGrid
    }
    else if(e.Item.OwnerTableView.Name=="Details")
    {
          //Your Code for detail table
    }
}

Hope this helps,else please elaborate your scenario.

Thanks
Princy
0
YUNUS EMRE
Top achievements
Rank 1
answered on 12 Jul 2013, 08:27 AM
  Thanks Princy,
  This solved my problem.
Tags
Grid
Asked by
YUNUS EMRE
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
YUNUS EMRE
Top achievements
Rank 1
Share this question
or