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

[Solved] Inserting new record when MultiRowedit is true

2 Answers 70 Views
Grid
This is a migrated thread and some comments may be shown as answers.
satya
Top achievements
Rank 1
satya asked on 15 Sep 2009, 01:21 PM
Hi,

    I have a issue when MultiRowEdit is made true. Actually I have to show all the rows in my grid in edit mode and when i press Add New record i should get the new row , but the insert/Cancel buttons will be invisible. I am facing problem in capturing the controls and their values of adding row . I have to capture those controls on a single Save button click in my page. So that i can add as well as modify edited rows and finally Save alltogether on a single save click. So in my Save button click i should capture the controls of adding row which i am unable to do. I can access the controls in edit mode as 

 

for (int pageitem = 0; pageitem < RgdDomainValues.Items.Count; pageitem++)

 

{


'RgdDomainValues.Items[myitemIndex].Controls[colindex].Controls[UIConstants.ZERO]' .......

}

 Can u please suggest me how can i get the controls of inserting row .

Thanks,
Satya.

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 16 Sep 2009, 06:21 AM
Hi Satya,

You may try the following code snippet to hide the Insert ans Cancel button of the Insert form.

CS:
 
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
 
        if ((e.Item is GridEditFormInsertItem) && (e.Item.OwnerTableView.IsItemInserted)) 
        { 
            GridEditFormInsertItem insertForm = (GridEditFormInsertItem)e.Item; 
            insertForm.FindControl("PerformInsertButton").Visible = false
            insertForm.FindControl("CancelButton").Visible = false
        } 
   } 


Here is the code snippet to access the Insert form controls in an external button click event.

CS:
 
 protected void Button1_Click(object sender, EventArgs e) 
    { 
        if (RadGrid1.MasterTableView.IsItemInserted) 
        { 
            GridEditFormInsertItem insertForm = RadGrid1.MasterTableView.GetItems(GridItemType.EditFormItem)[0] as GridEditFormInsertItem; 
            TextBox txtbx = (TextBox)insertForm["columnUniquename"].Controls[0]; 
            string strtxt = txtbx.Text; 
        } 
    } 


Thanks
Princy
0
satya
Top achievements
Rank 1
answered on 17 Sep 2009, 11:38 AM
Thanks a lot. It worked out.

Regards,
Satya
Tags
Grid
Asked by
satya
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
satya
Top achievements
Rank 1
Share this question
or