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

Batch Edit Grid

3 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Prakash
Top achievements
Rank 1
Prakash asked on 10 Sep 2013, 09:33 AM

Hi,

   How to get the row index from text changed event for a text box which is placed inside the edit item template in batch edit grid.?

3 Answers, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 13 Sep 2013, 10:46 AM
Hello Prakash,

The requirement you have could not be achieved, since the "EditItemTemplate" is the same for every grid item and the server-side "TextChanged" event of TextBox control will fire only once (with values from the last edited item).

Since the purpose for that requirement is not specified in your post, I could only suggest an approach for getting the edited items row index by using the "BatchEditCommand" server-side event of the grid:
protected void RadGrid1_BatchEditCommand(object sender, GridBatchEditingEventArgs e)
{
    for (int i = 0; i < e.Commands.Count; i++)
    {
        int itemIndex = (e.Commands[i].Item as GridDataItem).ItemIndex;
    }
}

Hope that helps.

 

Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Prakash
Top achievements
Rank 1
answered on 13 Sep 2013, 11:14 AM
Hi Konstantin Dikov,

  I will explain you the purpose to which I need.

 I have a scenario in which I can type the code of an employee in edititemtemplate textbox, after typing once if i press tab or change the focus of that textbox, I have to retrieve the employee details relative to the code from the database and I should write those details in the same row in columns first name and last name(example say first name and last name of the employee). The first name and last name columns will not have edititemtemplate. All these things should be taken place before saving the grid.
0
Konstantin Dikov
Telerik team
answered on 18 Sep 2013, 11:41 AM
Hello Prakash,

For such scenario you could handle the "BatchEdit" events of the grid to retrieve the entered details and fire AJAX request through RadAjaxPanel or RadAjaxManager with those details as parameters. Then, on the server you could retrieve the required information for the passed parameters and set them in hidden field for an example. Afterwards on client-side you could set those values to the corresponding columns within the grid.

Here is how you could fire AJAX request on "OnBatchEditCellValueChanged" client-side event of the grid:
function cellValueChanged(sender, args) {
    var ajaxPanel = $find("<%=RadAjaxPanel1.ClientID%>");
    ajaxPanel.ajaxRequest("parameters");
}


Hope that helps.

 

Regards,
Konstantin Dikov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Grid
Asked by
Prakash
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Prakash
Top achievements
Rank 1
Share this question
or