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

access the insert row

3 Answers 107 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Amrutha
Top achievements
Rank 1
Amrutha asked on 27 Mar 2014, 06:09 AM
Hi,

I have a RadGrid with two bound columns and a RadComboBox in EditItemTemplate of the Template Column.The Grid is in batch edit mode. When i press Add New Record and select an item in RadComboBox , the bound column(textboxes) should get populated with the selected value in RadComboBox.

Thanks.

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 31 Mar 2014, 02:43 PM
Hello Amrutha,

Thank you for contacting us.

I prepared a small sample and attached it to this thread. Please give it a try and let me know about the result.

Regards,
Kostadin
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
0
Amrutha
Top achievements
Rank 1
answered on 01 Apr 2014, 03:49 AM
Hi Kostadin ,

Thanks for the sample. I tried the code. I have the following issues.

1. Insert mode-->The Item in combobox is selected and the textboxes are populated--> when i click on the save button--      >the OnClientSelectedIndexChanged event is firing again.

2. When the RadGrid id in edit mode --> select an item in combobox--> the combobox dropdown not getting closed.


I have attached an image of the exception I am getting in IE whenever i debug the page. Please provide a solution for this.

 Thanks, 
 Amrutha.



0
Kostadin
Telerik team
answered on 03 Apr 2014, 12:04 PM
Hi Amrutha,

Regards you first question we have already know about this behavior and I hope that a fix for it will be available in a near future. Meanwhile you could workaround it by using a boolean flag. When BatchEditClosing client event is fired you could set this flag to false and thus you can distinguished whether the OnClientSelectedIndexChanged event is fired by the batch editor or not.The second issue which you are facing is caused by the sender.get_parent() function. Basically when you are inserting a new row this function will return the row element while if you edit a row this method will return the tableView. Nevertheless you could use the following approach to get the current edit row.
var dataItem = $find(Telerik.Web.UI.Grid.GetFirstParentByTagName(sender.get_element(), 'tr').id);
var firstInput = dataItem.get_cell("Column2").getElementsByTagName("input")[0];

Additionally I modified the sample from my previous reply and attached it to this thread.

Regards,
Kostadin
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Amrutha
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Amrutha
Top achievements
Rank 1
Share this question
or